I use Java’s rabbitmq-client (https://mvnrepository.com/artifact/com.rabbitmq/amqp-client) and I need to implement the following scenario:
What would be the best way to implement pause/resume of listening from a RabbitMQ queue using the amqp-client Java library?
You don’t mention which method you’re using to consume messages, so I assume you are using
basicConsume to subscribe to messages from a queue.
As that document mentions, you can use
basicCancel to stop consuming from a queue. You would then use
basicConsume when you wish to start again.
Be sure to use
basicQos to set a reasonable prefetch count.