You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mta38 <mt...@orange-ftgroup.com> on 2009/01/06 15:33:09 UTC
Force Camel wait all route execution
Hi all,
Is a way exist when use a DirectEndpoint to force camel wait execution of
all routes before send response back to first endpoint ?
For example if I have the following routes
<camelContext id="camel" ..>
<from uri="direct:A">
<to uri="">
…
N routes
</camelContext>
Want camel execute the N routes before send response back to "direct:A".
Best regards,
Mta38
--
View this message in context: http://www.nabble.com/Force-Camel-wait-all-route-execution-tp21311484s22882p21311484.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Force Camel wait all route execution
Posted by James Strachan <ja...@gmail.com>.
2009/1/7 Willem Jiang <wi...@gmail.com>:
> I think Camel already supports it if your routes elements are alway
> instace of OutputType.
You meant InOut there right? i.e. if the messaging is request-response
http://activemq.apache.org/camel/request-reply.html
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from uri="direct:start"/>
> <to uri="some endpoint1"/>
> <to uri="some endpoint2"/>
> <to uri="some endpoint3"/>
> </route>
> </camelContext>
>
> Camel will use a pipeline to chain these endpoints up, if the message
> exchange pattern is InOut, you will get the response which is produced
> by the "some endpont3" from "direct:A".
>
> But if your routes configured like this, I don't think camel support this.
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from uri="direct:start"/>
> <to uri="queue:mid"/>
> </route>
> <route>
> <from uri="queue:mid"/>
> ... some slow endpoint
> </route>
> </camelContext>
>
> Willem
>
>
> mta38 wrote:
>> Hi all,
>>
>> Is a way exist when use a DirectEndpoint to force camel wait execution of
>> all routes before send response back to first endpoint ?
>>
>> For example if I have the following routes
>>
>> <camelContext id="camel" ..>
>> <from uri="direct:A">
>> <to uri="">
>> …
>> N routes
>>
>> </camelContext>
>>
>> Want camel execute the N routes before send response back to "direct:A".
>> Best regards,
>> Mta38
>>
>
>
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/
Re: Force Camel wait all route execution
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah if all the N other endpoints is also sync, then the response to
the original caller will wait until all is completed.
The N routes what kind of routing are they?
On Wed, Jan 7, 2009 at 4:29 AM, Willem Jiang <wi...@gmail.com> wrote:
> I think Camel already supports it if your routes elements are alway
> instace of OutputType.
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from uri="direct:start"/>
> <to uri="some endpoint1"/>
> <to uri="some endpoint2"/>
> <to uri="some endpoint3"/>
> </route>
> </camelContext>
>
> Camel will use a pipeline to chain these endpoints up, if the message
> exchange pattern is InOut, you will get the response which is produced
> by the "some endpont3" from "direct:A".
>
> But if your routes configured like this, I don't think camel support this.
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
> <route>
> <from uri="direct:start"/>
> <to uri="queue:mid"/>
> </route>
> <route>
> <from uri="queue:mid"/>
> ... some slow endpoint
> </route>
> </camelContext>
>
> Willem
>
>
> mta38 wrote:
>> Hi all,
>>
>> Is a way exist when use a DirectEndpoint to force camel wait execution of
>> all routes before send response back to first endpoint ?
>>
>> For example if I have the following routes
>>
>> <camelContext id="camel" ..>
>> <from uri="direct:A">
>> <to uri="">
>> …
>> N routes
>>
>> </camelContext>
>>
>> Want camel execute the N routes before send response back to "direct:A".
>> Best regards,
>> Mta38
>>
>
>
--
/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/
Re: Force Camel wait all route execution
Posted by Willem Jiang <wi...@gmail.com>.
I think Camel already supports it if your routes elements are alway
instace of OutputType.
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="direct:start"/>
<to uri="some endpoint1"/>
<to uri="some endpoint2"/>
<to uri="some endpoint3"/>
</route>
</camelContext>
Camel will use a pipeline to chain these endpoints up, if the message
exchange pattern is InOut, you will get the response which is produced
by the "some endpont3" from "direct:A".
But if your routes configured like this, I don't think camel support this.
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="direct:start"/>
<to uri="queue:mid"/>
</route>
<route>
<from uri="queue:mid"/>
... some slow endpoint
</route>
</camelContext>
Willem
mta38 wrote:
> Hi all,
>
> Is a way exist when use a DirectEndpoint to force camel wait execution of
> all routes before send response back to first endpoint ?
>
> For example if I have the following routes
>
> <camelContext id="camel" ..>
> <from uri="direct:A">
> <to uri="">
> …
> N routes
>
> </camelContext>
>
> Want camel execute the N routes before send response back to "direct:A".
> Best regards,
> Mta38
>
Re: Force Camel wait all route execution
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Looks like the aggregator pattern we you need to aggregate all the
reponses from the N routes before you can return a response to the
first endpoint.
Do you have a fixed size of N endpoints you send to? Then your
completion predicate is when you have aggregated N exchanges.
http://activemq.apache.org/camel/aggregator.html
On Tue, Jan 6, 2009 at 3:33 PM, mta38 <mt...@orange-ftgroup.com> wrote:
>
> Hi all,
>
> Is a way exist when use a DirectEndpoint to force camel wait execution of
> all routes before send response back to first endpoint ?
>
> For example if I have the following routes
>
> <camelContext id="camel" ..>
> <from uri="direct:A">
> <to uri="">
> …
> N routes
>
> </camelContext>
>
> Want camel execute the N routes before send response back to "direct:A".
> Best regards,
> Mta38
>
> --
> View this message in context: http://www.nabble.com/Force-Camel-wait-all-route-execution-tp21311484s22882p21311484.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/