Even though I have a non-exclusive queue, I noticed that messages are delivered to consumers in round-robin manner based on when they connect. I am using JCSMP and set EndpointProperties to ACCESSTYPE_NONEXCLUSIVE.
Here is how I tested:
(1) Before starting any message consumers, I send the 1st batch of 20 messages to a queue.
(2) I start Consumer 1 which processes messages with a delay of 2 seconds each message.
(3) Next, I start Consumer 2 while Consumer 1 is consuming the 1st batch of messages. Even though Consumer 2 is running, but it is idling as messages from the 1st batch are not delivered to it.
(4) I send the 2nd batch of 20 messages. These messages from the 2nd batch are delivered in a round robin manner to Consumer 1 and Consumer 2.
(5) While Consumer 1 is processing messages from the 1st batch and 2nd batch, and while Consumer 2 is processing messages from the 2nd batch, I start Consumer 3. Although Consumer 3 is running but it is idling as no messages from 1st batch and 2nd batch are delivered to it.
(6) I send the 3rd batch of 20 messages. These messages from the 3rd batch are delivered in a round robin manner to Consumer 1, Consumer 2 and Consumer 3.
I was expecting that regardless when the messages are stored in the queue, the moment I start any consumers, messages should be delivered to them. This is important so that I can start more consumers to clear the backlog if messages are piled up in a queue. But, based on what I experimented, it does not seem to work. Did I miss out any settings somewhere?
Appreciate your advice. Thank you.