Search code examples
javaspringrabbitmqamqp

How to stop listeners in SimpleMessageListenerContainer


I have 5 concurrentConsumers. How can I stop listening queue but let my consumers finish task (not republish message back to queue in the middle of the business logic) ?

If I call stop()/shutdown() method in SimpleMessageListenerContainer it waits for default 5 secconds and Forcing connections to close, and republishes messages.


Solution

  • That's a bug; the container should wait for inflight messages to complete but not start processing new ones. This is fixed - https://jira.springsource.org/browse/AMQP-338

    Original post