Stop consumption of message for rabbitmq for a period of time

Viewed 117

Calling the stop method of SimpleMessageListenerContainer class is closing the channel ("Closing channel for unresponsive consumer"). But I don't want to close the channel. I am trying to stop the consumption of messages for a period of time and after some time I want to resume consumption of the message. Can anyone please suggest to me how can I do that?

1 Answers

It sounds like you might be stopping the container from the listener thread - that causes a deadlock.

Call the stop on another thread.

someTaskExecutor.execute(() -> container.stop());

This will free up the listener thread.

Related