You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by marco-dak <bu...@dakosy.de> on 2016/02/23 10:17:28 UTC

Message processed in wrong order

Hi,

I encounter an issue with Camel (2.13) and ActiveMQ (5.11.1) on JBoss EAP
(6.1) where messages are processed in wrong order. It only occurs if there
are a lot of messages send to a single queue.

I can reproduce it with a very simple example:

<route id="sendRoute">
	<c:from uri="activemq:queue:START-QUEUE" />
	<loop>
		<constant>1000</constant>

		<c:setHeader headerName="testHeader">
			<simple>${property.CamelLoopIndex}</simple>
		</c:setHeader>
		<c:to uri="activemq:queue:DESTINATION-QUEUE" pattern="InOnly"/>
			
		<c:setHeader headerName="testHeader">
			<simple>${property.CamelLoopIndex}a</simple>
		</c:setHeader>    			
		<c:to uri="activemq:queue:DESTINATION-QUEUE" pattern="InOnly"/>
	</loop>
</route>

<route id="destinationRoute">
	<c:from uri="activemq:queue:DESTINATION-QUEUE" />
	<c:log message="$simple{header.testHeader}" />
</route>

I'm starting this example by sending a message to activemq:queue:START-QUEUE
via ActiveMQ console.

In the first route I set the loop index to the header and send it to
activemq:queue:DESTINATION-QUEUE. Than I overwrite the header by adding an
"a" to the loop index and send it also to activemq:queue:DESTINATION-QUEUE.

In the second route there is only one consumer reading messages from
activemq:queue:DESTINATION-QUEUE and log the header value that was set in
the first route.

I assumed that for the same index (e.g. 671) it should always logged before
the index containing the "a" (e.g. 671a), but it doesn't.

For example I got the following output in log:
08:17:49,666 INFO  [destinationRoute] 671a
...
08:17:52,385 INFO  [destinationRoute] 671

Why are the messages processed in the wrong order?
Is there any way to make sure that messages (for the same index) are always
procssed in the correct order?

If it not occurs if you run this example the first time, run it again.
Mostly it occurs after the first 200 messages are procssed in the correct
order.

It's very important for this project to process the messages send to
activemq:queue:DESTINATION-QUEUE in the correct order.



--
View this message in context: http://camel.465427.n5.nabble.com/Message-processed-in-wrong-order-tp5778100.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Message processed in wrong order

Posted by marco-dak <bu...@dakosy.de>.
I'm not sure how I can check the acutal order of messages in the queue. But I
stopped the consumer route and browsed the queue:

the IDs of messages are in the correct order:
- ID:P00278-57104-1456219720102-1:1:1:1:1133 -> 566
- ID:P00278-57104-1456219720102-1:1:1:1:1134 -> 566a

but the order I can see depends on the sort column of the ActiveMQ web
console. The timestamp of both messages in queue is 2016-02-23 10:36:03:404
MEZ

After I started the consumer route, I've got the following log messages:
09:50:41,735 INFO  [destinationRoute] 566a
...
09:50:45,944 INFO  [destinationRoute] 566

Is there any other way to see the actual order of messages in the queue?
Does it mean the problem is in the consuming route?



--
View this message in context: http://camel.465427.n5.nabble.com/Message-processed-in-wrong-order-tp5778100p5778105.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Message processed in wrong order

Posted by souciance <so...@gmail.com>.
I assume you checked that the messages were also put in the right
order.? and also if you stop the consumer route, how do the messages
look on the queue? Is 671a ahead of 671?

I understand that for yoru project processing in order is important
but just from experience, requirements based on order tend to get very
complicated and there are many situations to consider. If there is a
way to change that it would be good for the long term.

On Tue, Feb 23, 2016 at 10:17 AM, marco-dak [via Camel]
<ml...@n5.nabble.com> wrote:
> Hi,
>
> I encounter an issue with Camel (2.13) and ActiveMQ (5.11.1) on JBoss EAP
> (6.1) where messages are processed in wrong order. It only occurs if there
> are a lot of messages send to a single queue.
>
> I can reproduce it with a very simple example:
>
> <route id="sendRoute">
>         <c:from uri="activemq:queue:START-QUEUE" />
>         <loop>
>                 <constant>1000</constant>
>
>                 <c:setHeader headerName="testHeader">
>                         <simple>${property.CamelLoopIndex}</simple>
>                 </c:setHeader>
>                 <c:to uri="activemq:queue:DESTINATION-QUEUE"
> pattern="InOnly"/>
>
>                 <c:setHeader headerName="testHeader">
>                         <simple>${property.CamelLoopIndex}a</simple>
>                 </c:setHeader>
>                 <c:to uri="activemq:queue:DESTINATION-QUEUE"
> pattern="InOnly"/>
>         </loop>
> </route>
>
> <route id="destinationRoute">
>         <c:from uri="activemq:queue:DESTINATION-QUEUE" />
>         <c:log message="$simple{header.testHeader}" />
> </route>
>
> I'm starting this example by sending a message to activemq:queue:START-QUEUE
> via ActiveMQ console.
>
> In the first route I set the loop index to the header and send it to
> activemq:queue:DESTINATION-QUEUE. Than I overwrite the header by adding an
> "a" to the loop index and send it also to activemq:queue:DESTINATION-QUEUE.
>
> In the second route there is only one consumer reading messages from
> activemq:queue:DESTINATION-QUEUE and log the header value that was set in
> the first route.
>
> I assumed that for the same index (e.g. 671) it should always logged before
> the index containing the "a" (e.g. 671a), but it doesn't.
>
> For example I got the following output in log:
> 08:17:49,666 INFO  [destinationRoute] 671a
> ...
> 08:17:52,385 INFO  [destinationRoute] 671
>
> Why are the messages processed in the wrong order?
> Is there any way to make sure that messages (for the same index) are always
> procssed in the correct order?
>
> If it not occurs if you run this example the first time, run it again.
> Mostly it occurs after the first 200 messages are procssed in the correct
> order.
>
> It's very important for this project to process the messages send to
> activemq:queue:DESTINATION-QUEUE in the correct order.
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Message-processed-in-wrong-order-tp5778100.html
> To start a new topic under Camel - Users (activemq), email
> ml-node+s465427n465429h62@n5.nabble.com
> To unsubscribe from Camel - Users, click here.
> NAML




--
View this message in context: http://camel.465427.n5.nabble.com/Message-processed-in-wrong-order-tp5778100p5778101.html
Sent from the Camel - Users mailing list archive at Nabble.com.