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: routingSlip and async destinations
Date Wed, 12 May 2010 04:35:00 GMT
On Wed, May 12, 2010 at 1:21 AM, Jon Anstey <janstey@gmail.com> wrote:
> In RoutingSlipCreator maybe add a slip like
> "jms:foo?exchangePattern=InOut,jms:bar?exchangePattern=InOut" instead of
> just the plain endpoint URIs.
>

Yeah the MEP impacts how the messages gets routed in the Routing Slip EIP.

You use InOnly which causes the JmsProducer just to send the message
to the JMS queue and then continue immediately.
If you want it to wait for a reply, then you must use InOut



> On Tue, May 11, 2010 at 7:12 PM, Scott Parkerson
> <scott.parkerson@gmail.com>wrote:
>
>> Camel riders,
>>
>> I've got a route that makes use of the Routing Slip EIP. Right now, a
>> processor is used to create the header to be used with the routingSlip
>> processor. Once that is done, the routingSlip then passes the messages
>> on to one or more ActiveMQ queues as targets.
>>
>> It was my understanding that the Routing Slip EIP is supposed to take
>> a message and send it to each destination synchronously (i.e. go to
>> destination "A", then destination "B", and so on until all of the
>> destinations in the routing slip header are visited, or an exception
>> occurs). However, during my experimentation, I've seen that the
>> routing slip processor seems to happily "fulfill" its duties by
>> sending to all of the destinations near simultaneously if the
>> destinations are ActiveMQ queues.
>>
>> Here's my RouteBuilder:
>>
>> /*..*/
>>        getContext().addInterceptStrategy(new Tracer());
>>
>>        from("activemq:results")
>>            .unmarshal(bufFormatter)
>>            .bean(RoutingSlipCreator.class) /* adds "activemq:foo,
>> etc. as needed"
>>            .routingSlip("routingSlip");
>>
>>        from("activemq:foo")
>>            .bean(Foo.class);
>>
>>        from("activemq:bar")
>>            .bean(Bar.class);
>>
>>        from("activemq:baz")
>>            .bean(Baz.class);
>>
>>        from("activemq:quux")
>>            .bean(Quux.class);
>>
>> And here's an example of the tracer tracing this interaction (I've
>> deleted the contents of the body for brevity):
>>
>> DefaultMessageListenerContainer-1 INFO
>> [org.apache.camel.processor.interceptor.Tracer] -
>> ID:xyzzy.ateb.com-52179-1273613387168-2:5:1:1:1 >>> (route1)  -->
>>
>> com.ateb.dataproc.obc_processor.processor.postcontact.RoutingSlipCreator@407e75d2
>> <<< Pattern:InOnly, Headers:{JMSPriority=4, JMSDeliveryMode=2,
>> JMSMessageID=ID:xyzzy.ateb.com-52179-1273613387168-2:5:1:1:1,
>> JMSCorrelationID=null, JMSRedelivered=false,
>> JMSTimestamp=1273613390576, JMSType=null, JMSReplyTo=null,
>> underTest=true, JMSDestination=queue://results, JMSXGroupID=null,
>> JMSExpiration=0}, BodyType:java.util.HashMap, Body:{ ... }
>>
>> DefaultMessageListenerContainer-1 INFO
>> [org.apache.camel.processor.interceptor.Tracer] -
>> ID:xyzzy.ateb.com-52179-1273613387168-2:5:1:1:1 >>> (route1)
>>
>> com.ateb.dataproc.obc_processor.processor.postcontact.RoutingSlipCreator@407e75d2
>> --> routingSlip[routingSlip] <<< Pattern:InOnly,
>> Headers:{JMSDeliveryMode=2,
>> routingSlip=activemq:foo,activemq:bar,activemq:baz,activemq:quux,
>> JMSMessageID=ID:xyzzy.ateb.com-52179-1273613387168-2:5:1:1:1,
>> JMSDestination=queue://results, JMSRedelivered=false, underTest=true,
>> JMSPriority=4, JMSTimestamp=1273613390576, JMSCorrelationID=null,
>> JMSType=null, JMSReplyTo=null, JMSXGroupID=null, JMSExpiration=0},
>> BodyType:java.util.HashMap, Body:{ ... }
>>
>> DefaultMessageListenerContainer-1 INFO
>> [org.apache.camel.processor.interceptor.Tracer] -
>> ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:2:1 >>> (route3)
>> from(activemq://bar) -->
>> com.ateb.dataproc.obc_processor.processor.postcontact.Bar@1ee2433b <<<
>> Pattern:InOnly, Headers:{JMSCorrelationID=null,
>> CamelJmsDeliveryMode=2, underTest=true, JMSType=null,
>> JMSXGroupID=null, JMSTimestamp=1273613391428, JMSExpiration=0,
>> JMSDestination=queue://bar, JMSReplyTo=null, JMSRedelivered=false,
>> JMSMessageID=ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:2:1,
>> JMSPriority=4, JMSDeliveryMode=2,
>> routingSlip=activemq:baz,activemq:quux}, BodyType:java.util.HashMap,
>> Body:{ ... }
>>
>> DefaultMessageListenerContainer-1 INFO
>> [org.apache.camel.processor.interceptor.Tracer] -
>> ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:3:1 >>> (route4)
>> from(activemq://baz) -->
>> com.ateb.dataproc.obc_processor.processor.postcontact.Baz@5809fdee <<<
>> Pattern:InOnly, Headers:{JMSTimestamp=1273613391434, JMSXGroupID=null,
>> CamelJmsDeliveryMode=2,
>> JMSMessageID=ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:3:1,
>> JMSPriority=4, routingSlip=activemq:quux, JMSDeliveryMode=2,
>> JMSExpiration=0, JMSReplyTo=null, JMSType=null, JMSRedelivered=false,
>> JMSDestination=queue://baz, JMSCorrelationID=null, underTest=true},
>> BodyType:java.util.HashMap, Body:{ ... }
>>
>> DefaultMessageListenerContainer-1 INFO
>> [org.apache.camel.processor.interceptor.Tracer] -
>> ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:1:1 >>> (route2)
>> from(activemq://foo) -->
>> com.ateb.dataproc.obc_processor.processor.postcontact.Foo@43ce663c <<<
>> Pattern:InOnly, Headers:{JMSXGroupID=null, JMSPriority=4,
>> JMSDeliveryMode=2, CamelJmsDeliveryMode=2, JMSTimestamp=1273613391410,
>> JMSExpiration=0, JMSType=null, JMSCorrelationID=null, underTest=true,
>> JMSReplyTo=null, JMSDestination=queue://foo,
>> routingSlip=activemq:bar,activemq:baz,activemq:quux,
>> JMSRedelivered=false,
>> JMSMessageID=ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:1:1},
>> BodyType:java.util.HashMap, Body:{...}
>>
>> DefaultMessageListenerContainer-1 INFO
>> [org.apache.camel.processor.interceptor.Tracer] -
>> ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:4:1 >>> (route5)
>> from(activemq://quux) -->
>> com.ateb.dataproc.obc_processor.processor.postcontact.Quux@34cef6f1
>> <<< Pattern:InOnly, Headers:{underTest=true,
>> JMSMessageID=ID:xyzzy.ateb.com-52179-1273613387168-2:7:1:4:1,
>> CamelJmsDeliveryMode=2, routingSlip=, JMSTimestamp=1273613391450,
>> JMSDeliveryMode=2, JMSXGroupID=null, JMSExpiration=0,
>> JMSDestination=queue://quux, JMSRedelivered=false, JMSPriority=4,
>> JMSReplyTo=null, JMSType=null, JMSCorrelationID=null},
>> BodyType:java.util.HashMap, Body:{ ...}
>>
>> So, what am I to do here? The reason I have these broken out into
>> separate queues is to be able to break up the transactions; some of
>> the processors require outside resources (Webservices, for example)
>> which may be down or problematic. I'd like to be able to deal with
>> that gracefully should any one of the processes fail without having to
>> repeat the pieces of the routing slip that have been successfully
>> dealt with.
>>
>> But more troubling to me is that the DSL makes it extremely easy to
>> write an "implementation" of the Routing Slip EIP which doesn't work
>> like a routing slip at all.
>>
>> Is there any way to fix my route so it works? Do I have to make all of
>> my exchanges InOut, perhaps? Help!
>>
>> Thanks,
>> Scott
>>
>
>
>
> --
> Cheers,
> Jon
>
> Camel in Action: http://manning.com/ibsen
> Blog: http://janstey.blogspot.com
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message