Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-3031

Add new callback for broker deactivation

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.17.0
    • Broker
    • None

    Description

      There doesn't appear to be a way to tell when the Artemis server is starting to stop. This is needed to communicate with some web applications running inside the server's JVM. For example, it is needed to suspend or stop Camel before much of the Artemis server shuts down. Currently, most of the Artemis server's components shutdown before the WebServerComponent does, which contains web applications like Camel. A SERVER_STOP_CALLED Notification can be used to suspend or stop Camel via JMX before the Artemis server's acceptors shutdown.

      One way to accomplish this is to:

      1) Add a new SERVER_STOP_CALLED enum to org.apache.activemq.artemis.api.core.management.CoreNotificationType.

      2) Send a SERVER_STOP_CALLED Notification in org.apache.activemq.artemis.cli.commands.Run.stop() like the following:

               if (server != null) {
                  // Start new code
                  TypedProperties props = new TypedProperties();
                  props.putSimpleStringProperty(new SimpleString("callingClass"), new SimpleString(this.getClass().getName()));
                  props.putSimpleStringProperty(new SimpleString("callingMethod"), new SimpleString("stop"));
                  server.getServer().getManagementService().sendNotification(new Notification(null, SyndeoNotificationType.SERVER_STOP_CALLED, props));
                  // End new code
      
                  server.stop(true);
               }

      Without this feature, web applications like Camel can take a long time to shutdown depending on the configuration. Also, the shutdown can appear ungraceful and it's unclear what impact it has on inflight messages.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              steigerwalda Aaron Steigerwald
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m