Reputation: 1273
I have a scenario where I need to detach a rabbitmq consumer from the exchange, on a specific event, so that it stops consuming the messages in the queue and then reattach the same consumer to the exchange and start consuming the messages again. I'm using Spring-RabbitMQ 1.6.
So far, I have read a few pages on the internet e.g. http://www.programcreek.com/java-api-examples/index.php?api=org.springframework.amqp.rabbit.core.RabbitAdmin
and http://docs.spring.io/spring-amqp/docs/1.6.0.RC1/reference/htmlsingle/#idle-containers and many others but couldn't exactly understand how to make it work.
Upvotes: 2
Views: 796
Reputation: 174574
You can simply call container.stop()
to stop the consumer; start()
will restart it.
Upvotes: 2