camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakub Korab <jakub.korab.li...@gmail.com>
Subject Re: How to handle requests sequentially for a given item
Date Tue, 20 Jan 2015 17:46:26 GMT
If you have access to ActiveMQ you could try putting the requests onto a
JMS queue, and using Message Groups
(http://activemq.apache.org/message-groups.html). Putting the item id in
the JMSXGroupId header will ensure that only one JMS consumer processes
the total set of messages for that item id sequentially.

The Camel code is then really straightforward.

from(...)
    .setHeader("JMSXGroupId", simple("${body.itemId}"))
    .to("jms:items");

from("jms:items")...

Jakub

On 20/01/15 16:12, arthurs wrote:
> I need to only execute one route request at a time for a given item (ie
> object processed by the route).  So, if the second request with same item id
> comes in, it waits until the first one completes before continuing with
> processing.
>
> I understand that I can use onCompletion and thread libraries to implement
> this, but was wondering if there is a more elegant solution.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-handle-requests-sequentially-for-a-given-item-tp5761955.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message