[jboss-user] [JBoss Messaging] - Redelivery problem when using MessageSelectors

Toby Morris do-not-reply at jboss.com
Wed Dec 1 09:21:31 EST 2010

Toby Morris [http://community.jboss.org/people/theamazingtoby] created the discussion

"Redelivery problem when using MessageSelectors"

To view the discussion, visit: http://community.jboss.org/message/573875#573875

We’ve come across a scenario where messages are being set for redelivery when we don’t believe they should be.

Our setup:
-         Multiple consumers, using message selectors, set to watch the queue in turns. One will wait for the next message. Once that consumer either finds a message or times out waiting, it releases a synchronized method allowing another consumer to get the next message. This continues until the server is shut down.
-         Multiple producers writing to the queue whenever they need to.
-         JMS queue with a redelivery time set to 5 minutes.

What we’re seeing is if a consumer connects to the queue while there are messages waiting, some to all of those messages will get set to redeliver. If a message enters the queue while a consumer is waiting, it will process it as normal.

Unit testing has been performed to replicate this condition. If we set multiple consumers (two in this case) to watch the queue even constantly, and release messages in a controlled manner, we can get a redelivered message everytime.

We found three things that seem to be required for this situation to occur:
1. The queue has to have a redelivery time greater than -1. If the time is -1, the problem doesn’t occur.

2. The consumer must use a message selector. Without a selector, we don’t see the problem.

I can post our unit test code and more information, if requested.

Reply to this message by going to Community

Start a new discussion in JBoss Messaging at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101201/e515f6c3/attachment.html 

More information about the jboss-user mailing list