[
https://issues.apache.org/jira/browse/ARTEMIS-3031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17252007#comment-17252007
]
Aaron Steigerwald commented on ARTEMIS-3031:
--------------------------------------------
Yes, I've got a Camel web application deployed within the same JVM as the
broker.
I am using the ActivateCallback interface and have implemented the deactivate()
and activationComplete() methods for suspending and resuming Camel. The problem
is deactivate() is called after Artemis has already shutdown some of its
components that affect Camel connections. Camel logs errors and takes several
seconds to shutdown (7 in the attached example), which is likely due to the
Camel connection retry strategy.
The attached logs illustrate the difference between suspending embedded Camel
immediately after an Artemis stop is initiated using the SERVER_STOP_CALLED
Notification versus a regular embedded Camel shutdown without the
SERVER_STOP_CALLED Notification. Suspending Camel using the deactivate() method
produces the same results as shutting down without the SERVER_STOP_CALLED
Notification. I did not provide the deactivate() method log file because it's a
bit of effort to modify everything in my environment to generate it. I verified
the behavior during development. I can generate the deactivate() method log if
you would like to see it.
> Add SERVER_STOP_CALLED Notification
> -----------------------------------
>
> Key: ARTEMIS-3031
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3031
> Project: ActiveMQ Artemis
> Issue Type: New Feature
> Components: Broker
> Reporter: Aaron Steigerwald
> Priority: Minor
> Attachments:
> Artemis_Camel_shutdown_with_SERVER_STOP_CALLED_Notification.txt,
> Artemis_Camel_shutdown_without_SERVER_STOP_CALLED_Notification.txt
>
>
> 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:
> {noformat}
> 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);
> }{noformat}
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)