The fact that there are multiple consumers should not matter, because the messages are being assigned to "message groups" and AMQ should dispatch all messages in a particular group to one consumer thus guaranteeing the order of the messages in the group. See http://activemq.apache.org/message-groups.html
I have tried this and it works fine for me. Although, I am using an "asynchronous listener" and not polling for messages. Daryl Richter-3 wrote: > > I assume you have multiple consumers. In this case, order is *not* > preserved. > > Please see this page: > > http://activemq.apache.org/how-do-i-preserve-order-of-messages.html > > > On Sep 17, 2007, at 5:47 PM, wojtek.z wrote: > >> >> Howdy >> >> We are currently experiencing a bit of a problem with one of our >> applications which relates to messages being retrieved from the >> queue not in >> order / sequence. >> >> The basic idea is as follows >> >> We create 3 sets of messages >> Each message is tagged to a unique group >> Each message is tagged with a sequence number of 1 - 3 >> Each message is sent to the queue separately >> >> Now when we view the queue the messages are lined up in order ( ie >> Group A = >> 1 , 2 , 3 ) >> >> When we retrieve the messages though there is a very high chance >> that the >> messages dont come off the queue in the order they were put on >> there. If we >> have to sets of 3 messages ( from group A / B ) they tend to come >> across >> along the lines of A1 , B1 , A3 , B3 , A2 , B2. Now sometimes they >> shuffle >> around sometimes they come of the queue properly ( mostly only when >> 1 set of >> messages is active any more then that and the order breaks ) >> >> The way we retrieve the messages is also very simple, we simply >> poll the >> queue and grab each message one by one. >> >> I did some reading and there were a few bugs reported back in >> version 4.0.x >> that mentioned these problems. I tried this exercise with versions >> 4.0.1 and >> 4.1.1 and neither seem to work correctly. >> >> Is there a work around to this problem or maybe I am just doing >> something >> very silly that is causing this. Anyway if someone could let me >> know that >> would be most beneficial. Thanks ! >> -- >> View this message in context: http://www.nabble.com/Retrieving- >> Messages-Out-of-Sequence-tf4470245s2354.html#a12745847 >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. >> > > -- > Daryl > http://itsallsemantics.com > > "Under capitalism, man exploits man. > Under communism, it's just the opposite." > -- John Kenneth Galbraith > > > -- View this message in context: http://www.nabble.com/Retrieving-Messages-Out-of-Sequence-tf4470245s2354.html#a12747860 Sent from the ActiveMQ - User mailing list archive at Nabble.com.