Derrops
Derrops

Reputation: 8127

What happens when you have multiple JMS listeners in Spring competing for processing resources?

What happens if I have many @JmsListener(destination = ...), listening for messages on different queues. Who gets to listen first, how can I control this behavior.

Upvotes: 0

Views: 270

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

You cannot control the fine level behavior in any meaningful way; work is scheduled by the operating system scheduler.

You can control the behavior at a gross level by starting/stopping the listener containers - give the listeners an id property and start/stop the containers via the JmsListenerEndpointRegistry bean.

But you can't "control consumption" per your other question. I suggested there to use the JmsTemplate instead.

Upvotes: 2

Related Questions