2

Am using the @MessageMapping(queue_name) annotation along with the spring-aws-cloud library to consume messages from two SQS queues.

I see that the SimpleMessageListenerContainer is used as the listener container for both message queues. There is a start() and a stop() method on the container, but I believe that will start/stop consumption from both queues.

I wanted to know if there is a way to programatically start/stop queue consumption for the queues separately. How can that be achieved?

mana
  • 6,347
  • 6
  • 50
  • 70

2 Answers2

1

Use start(queueName) and stop(queueName) function of SimpleMessageListenerContainer to start and stop individual queues programmatically.

harsh tibrewal
  • 785
  • 6
  • 21
0

You need separate containers for each queue to start/stop listening independently.

From a quick look at the code, it appears to me that there is only one listener container when using the annotation to create listeners.

I suggestion you open an issue/feature suggestion in GitHub; I suggest you post the issue number back here so interested parties can follow the discussion.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179