You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JIRA: https://jira.spring.io/browse/AMQP-785Fixes: #689
- Only stop the container on one thread
- Ignore concurrent stops
- Interrupt consumer threads that are attempting to declare queues
- In `restart()` don't start a new consumer if the container is stopping
- Defer publishing consumer failure events until container is stopped
- Add a RecoveryListener if needed to ensure channels are never recovered
- Fix event publishing for `Error` - it is fatal
__backport to 1.7.x will require work__
Clear the declaring flag when exiting `start()` with exception.
Release the `activeObjectCounter` when interrupted while declaring.
Polishing stopped container lifecycle
Since restarted consumer is not be aware about stopped container,
it can restart properly when RabbitMQ comes back on-line independently
of the container state
* Add `active` flag to the `ActiveObjectCounter` and `deactivate()`
and `isActive()` hooks
* Use `ActiveObjectCounter.deactivate()` in the container shutdown
* Use `ActiveObjectCounter.isActive()` in the
`BlockingQueueConsumer.cancelled()`
* Use `BlockingQueueConsumer.cancelled()` in its `start()` toi check
container activity before performing network job
* Check `isActive()` state in the `AbstractMessageListenerContainer.shutdown()`
* Remove `SimpleMessageListenerContainer.containerStopping` in favor of
`isActive()` hook
Conflicts:
build.gradle
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/AbstractMessageListenerContainer.java
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/ActiveObjectCounter.java
spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/SimpleMessageListenerContainer.java
Resolved.
Copy file name to clipboardExpand all lines: spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/AbstractMessageListenerContainer.java
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -547,12 +547,17 @@ public void initialize() {
547
547
* Stop the shared Connection, call {@link #doShutdown()}, and close this container.
548
548
*/
549
549
publicvoidshutdown() {
550
-
logger.debug("Shutting down Rabbit listener container");
551
550
synchronized (this.lifecycleMonitor) {
551
+
if (!isActive()) {
552
+
logger.info("Shutdown ignored - container is not active already");
553
+
return;
554
+
}
552
555
this.active = false;
553
556
this.lifecycleMonitor.notifyAll();
554
557
}
555
558
559
+
logger.debug("Shutting down Rabbit listener container");
560
+
556
561
// Shut down the invokers.
557
562
try {
558
563
doShutdown();
@@ -602,6 +607,9 @@ public final boolean isActive() {
0 commit comments