How to stop SimpleMessageListenerContainer instances?

806 Views Asked by At

We have several hosts which sends out messages through an Exchange. For these several hosts, i have created an instance of SimpleMessageListenerContainer that binds to a queue and host. I have registered a listener for the container. On Message retrieval, i look for a certain kind of message. If i receive the message, i would like to stop the container but i dont know how to do it on the MessageListener end since i dont have the container instance there. Can someone please help me? Sorry if i have confused anyone. I am very new to AMQP and trying to understand it.

1

There are 1 best solutions below

3
On

Inject the container with an @Resource annotation and then call stop() on it when you receive the desired message.