camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel DynamicRouter requires state storage inside routing bean
Date Thu, 06 Nov 2014 16:50:20 GMT
You can keep state on the exchange itself on the properties

On Thu, Nov 6, 2014 at 5:19 PM, Rich Peters <rich.peters@braxtontech.com> wrote:
> Previously posted to the JBOSS Fuse mailing list with no response
>
> Camel provides a nice capability in the dynamic router.  However it inherits
> a weakness from routingSlip in that state must be kept inside the object
> with the method call.  Is there a nice way to have a one time routing slip
> without saving state?  currently you are forced to do something like this:
> (to determine that the second call is for the same message)
>
> public class MessageDistributionDynamicRouter
>
> {
>     //must keep state to stop the routing slip
>     private volatile Object lastBody = null ;
>
>     public String destinationQueue(@Header("sessionId") final String
> sessionId, @Body final Object body)
>     {
>         if (lastBody == body)
>         {
>             return null;
>         }
>         lastBody = body;
>
>         //route to destination outbound queue
>         return QueueName.getOutboundQueueName(sessionId) ;
>     }
> }
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-DynamicRouter-requires-state-storage-inside-routing-bean-tp5758615.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message