round robin delivery does not work properly?

round robin queue delivery does not work the way i would expect it to. (i think)

i am running :

broker : imq v2.0 on linux, red hat 7.2

client : java program on red hat linux, using sun's jvm, v1.2.2

test queue is with a delivery policy of round robin.

here is how i simulate the problem :

1. i populate the test queue with 200 (or whatever number of) messages.

2. i start up a client that creates a QueueConnection to the broker, launches n threads, each of which maintain a session and a QueueReceiver. the moment QueueConnection.start() is invoked, the threads start picking up the messages off the queue. the threads round robin internally. (i.e. thread 1 gets message 1, thread 2 gets message 2 etc)

3. while there are still several hundred messages in the queue, i launch another instance of the client. this client never picks up any messages off the queue, even though there are several, unacknowledged messages on the queue.

i would expect that the second instance of the client should start picking up messages off the queue immediately, but it never does. only when new messages are injected into the queue both instances start round robin'ing correctly.

did i miss something or is this the expected behaviour?

to summarize, let's say you have several hundred messages in a queue. you start one client that reads messages off the queue. as they are being processed, you realize that there are so many messages that it's better to launch another instance of the client to speed up processing. you start the second instance of the client and would expect some messages that are still on the queue to get picked up by the second client. it never does. the first client processes all the messages on the queue. only newly inserted messages start getting picked up by the second client instance.

your help and time is highly appreciated.

thanks

[1953 byte] By [706694] at [2007-11-25 8:16:35]
# 1

Our implementation of round-robin deliver may not

work as you expect ...

Messages in Round-robin mode are divided based on

how fast the client api can process the message

not how fast the application processes the message.

When 1 or more consumers attach to a waiting queue,

N messages are queued to each receiver. (where

N is defined by the property imq.queue.rr.messageblock).

Once the broker has been able to "send" all queued

messages to a client, it will queue the next batch

of messages for the receiver.

In your example ...

while there appears to be several hunderd unacknowledged

messages, the broker has already processed and forwarded

those messages to the local consumer.

We will be adding some different behaviors to Round-Robin delivery

in our post 3.0 feature release. One of those should allows you to

easily get the "pull" behavior that you are looking for (or get out

current behavior).

Until that release ...

You should be able to get the behavior that you are looking for in

our current (3.0) release by changing a couple of properties:

1. determine the maximum # of messages that can be waiting to

be processed by a receiver (e.g. 1)

2. change the Flow control properties on the connection factory

to:

imqFlowControlCount=<# of msgs waiting on a receiver>

imqFlowControlLimit=<# of msgs waiting on a receiver>

imqFlowControlIsLimited = true

e.g.

java -DimqFlowControlCount=1 -DimqFlowControlLimit=1

-DimqFlowControlIsLimited=true foo.java

3. set the message block property in the config.properties

file and restart the broker

imq.queue.rr.messageblock=<# of msgs waiting on a receiver>

If you are running 2.0 ...

Follow the instructions above BUT use the following properties instead:

JMQFlowControlCount=<# of msgs waiting on a receiver>

JMQFlowControlLimit=<# of msgs waiting on a receiver>

JMQFlowControlIsLimited = true

AND use the following name for the broker property:

jmq.queue.rr.messageblock

Guest at 2007-7-1 14:15:55 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...