You can stop messaging engines using different mechanisms and with different degrees of urgency. Stopping a messaging engine prevents it from sending any messages.
For each existing connection, the messaging engine waits for the current operation to complete, unless the operation blocks within the messaging engine, such as a receive operation. In this case, the operation is interrupted. Asynchronous consumers are allowed to complete even though they may take an arbitrary amount of time to process the current message. The messaging engine then backs out of active transactions and disallows any further operations on that connection. When all connections are in this invalidated state, the messaging engine stops.
Force mode is like immediate mode, except that stopping the messaging engine interrupts messaging operations on application threads that are taking place at the time that the stop command is issued. Rather than allowing existing messaging operations to complete, the messaging engine interrupts them and then disallows any further operations. When all connections are in this state, the messaging engine stops.
Force mode completes the shutdown of the messaging engine as fast as possible. A subsequent restart of the messaging engine might take longer than if it had been stopped using immediate mode, because more recovery actions are needed. For example, force mode stop can leave messages in-doubt and you must eal with these messages as described in Resolving in-doubt transactions.
You can escalate an immediate stop that is taking too long to force a stop.
Stop mechanism | Immediate | Force |
---|---|---|
Administrative console | Yes | Yes |
JMX stop command | Yes | Yes |
stopServer command | Yes | No |