user2599052
user2599052

Reputation: 1136

reception behaviour with multiple listeners on jms queue

If there are multiple listeners on a queue with each java process containing a single listener, then what is the pattern of reception when messages arrive on the queue. Will :

1) each listener take turn in receiving messages. ie Message1 goes to Listener1, message 2 goes to listener2 and so on

or

2) it be a random reception

or

3) it be JMS implementation dependent.

I am using Spring DMLC for receiving the messages.

Upvotes: 1

Views: 1726

Answers (1)

Gary Russell
Gary Russell

Reputation: 174749

It's completely indeterminate - it depends on many things...

  • the broker
  • how long a listener takes to process a message
  • prefetch settings
  • etc, etc.

It might start off round-robin but will quickly become random (not really random - predictable - the broker will generally send the next message to the first consumer that completes the processing of the previous message).

Upvotes: 3

Related Questions