3.4. Stopping broker instances
Stop the broker instance manually or configure the broker to shutdown gracefully.
3.4.1. Stopping the broker instance リンクのコピーリンクがクリップボードにコピーされました!
After creating the standalone broker and producing and consuming test messages, you can stop the broker instance.
This procedure manually stops the broker, which forcefully closes all client connections. In a production environment, you should configure the broker to stop gracefully so that client connections can be closed properly.
Procedure
Use the
artemis stopcommand to stop the broker instance:$ /var/opt/amq-broker/mybroker/bin/artemis stop 2018-12-03 14:37:30,630 INFO [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.6.1.amq-720004-redhat-1 [b6c244ef-f1cb-11e8-a2d7-0800271b03bd] stopped, uptime 35 minutes Server stopped!
3.4.2. Stopping a broker instance gracefully リンクのコピーリンクがクリップボードにコピーされました!
A manual shutdown forcefully disconnects all clients after a stop command is entered. As an alternative, configure the broker to shut down gracefully by using the graceful-shutdown-enabled configuration element.
When graceful-shutdown-enabled is set to true, no new client connections are allowed after a stop command is entered. However, existing connections are allowed to close on the client-side before the shutdown process is started. The default value for graceful-shutdown-enabled is false.
Use the graceful-shutdown-timeout configuration element to set a length of time, in milliseconds, for clients to disconnect before connections are forcefully closed from the broker side. After all connections are closed, the shutdown process is started. One advantage of using graceful-shutdown-timeout is that it prevents client connections from delaying a shutdown. The default value for graceful-shutdown-timeout is -1, meaning the broker waits indefinitely for clients to disconnect.
The following procedure demonstrates how to configure a graceful shutdown that uses a timeout.
Procedure
-
Open the configuration file
<broker_instance_dir>\etc\broker.xml. Add the
graceful-shutdown-enabledconfiguration element and set the value totrue.<configuration> <core> ... <graceful-shutdown-enabled> true </graceful-shutdown-enabled> ... </core> </configuration>Add the
graceful-shutdown-timeoutconfiguration element and set a value for the timeout in milliseconds. In the following example, client connections are forcefully closed 30 seconds (30000milliseconds) after thestopcommand is issued.<configuration> <core> ... <graceful-shutdown-enabled> true </graceful-shutdown-enabled> <graceful-shutdown-timeout> 30000 </graceful-shutdown-timeout> ... </core> </configuration>