activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wojtek.z" <wojtek.zinc...@autodata.net>
Subject Re: Retrieving Messages Out of Sequence
Date Tue, 18 Sep 2007 14:23:27 GMT

As it turned out the exclusive.consumer feature wasn't helping my situation.
So I took that out , but adding the maxSessions = 1 seems to guarantee
proper sequence everytime.

I have ran a number of test cases and it always comes up correct. I will
experiment more with different flags to see if i can narrow it down to a
specific culprid.

Thanks for the help.



ttmdev wrote:
> 
> Since you are using groups and sequence numbers, why not just rely on
> AMQ's "message groups" feature? That way you don't have to worry about
> tagging destinations with exclusive.consumer=true. 
>  
> 
> wojtek.z wrote:
>> 
>> Crap I think I answered my own questions :)
>> 
>> Problem was I wasn't setting the exclusive consumer / max Sessions on my
>> OUT queue, instead I was putting it on my IN queue which my listener
>> wasn't processing.
>> 
>> After setting it on the correct one it works with 4.1.1 ... stupidity
>> strikes again. Now on to try it with 4.0.1
>> 
>> 
>> wojtek.z wrote:
>>> 
>>> Thanks for the replies guys
>>> 
>>> Maybe to clarify I am using a custom message listener to retrieve the
>>> messages. I recently tried to set "exclusive consumer" as well as
>>> "maxSessions=1" but I still get the messages out of order. The strange
>>> thing I found was that if i put messages on the queue and my listener
>>> isnt running and then i turn it, the messages get retrieved as 3 , 2 ,
>>> 1. If I throw two sets of 3 messages they get retrieved as 3, 2, 1, 3,
>>> 2, 1, only sometimes.
>>> 
>>> When I have my listener running as I am putting messages on the queue
>>> they are retrieved as 1, 2, 3. Can anyone help me understand the
>>> inconsistency in behavior ?
>>> 
>>> Here is my config sample
>>> 
>>> 	<!-- ActiveMQ JCAConnectors -->
>>> 	<bean id="InQueConnector1" class="org.jencks.JCAConnector">
>>> 		<property name="jcaContainer" ref="jencks" />
>>> 		  <!-- Queue details -->
>>> 		<property name="activationSpec">
>>> 		    <bean class="org.apache.activemq.ra.ActiveMQActivationSpec">
>>> 		      <property name="destination"
>>> value="ActiveMQ.In.Queue1?consumer.exclusive=true"/>
>>> 		      <property name="destinationType" value="javax.jms.Queue"/>
>>>    		      <property name="maxSessions" value="1"/>
>>> 		    </bean>
>>> 		</property>
>>> 		  		
>>> 		<property name="ref" value="InQueListenerTarget1"/>
>>> 	</bean>
>>> 
>>> 
>>> 
>>> 
>>> Daryl Richter-3 wrote:
>>>> 
>>>> On Sep 17, 2007, at 8:35 PM, ttmdev wrote:
>>>> 
>>>>>
>>>>> 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
>>>> 
>>>> Sorry, I missed the part where he mentioned the groups.  The page I  
>>>> referenced does say that Message Groups should preserve order, so  
>>>> perhaps this is a bug.
>>>> 
>>>> 
>>>>>
>>>>> 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.
>>>>>
>>>> 
>>>> --
>>>> Daryl
>>>> http://itsallsemantics.com
>>>> 
>>>> "We want great men who, when fortune frowns, will not be discouraged."
>>>>      -- Colonel Henry Knox, 1776
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Retrieving-Messages-Out-of-Sequence-tf4470245s2354.html#a12758083
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message