Is there a way to gracefully stop a ListenerContainer
, and its associated Consumers
.
What I'm trying to achieve.
- Stop consuming messages.
- Gracefully stop
ListenerContainer
. - Await long running consumers, and ack when finished.
I'm able to stop the ListenerContainers
using consumer.stop()
, but active long running consumers won't complete successfully, and processed messages won't be acked and will therefore be processed again, once the ListenerContainer has been resumed.
Output
Waiting for workers to finish.
Workers not finished.
Closing channel for unresponsive consumer: Consumer@6d229b1c
The message was processed, but not acked.
I might be able to achieve a graceful shutdown using setForceCloseChannel(false)
, but is it possible to verify if the cancelled consumers has finished? SimpleMessageListenerContainer.doShutDown() has a local scoped List "canceledConsumers".