You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vishalad <ad...@gmail.com> on 2012/02/27 08:14:46 UTC

Invoking the same Camel route multiple times.

Hi, 

I have a situation in my Camel code (version 2.8) where I get the telephone
numbers list from one camel route and that telephone numbers list size is
not fixed (may vary). Then, i need to invoke another route for each
telephone number in that list. So, is it possible to invoke the same route
multiple times (over the size of the telephone numbers list) concurrently.
And second part of it is, I need to aggregate the response of all the
telephone numbers in one response. 

Does any one came across similar kind of scenario or any idea how can we
achieve this? 
Any help would be appreciated.

Thanks in advance,
Vishal.



--
View this message in context: http://camel.465427.n5.nabble.com/Invoking-the-same-Camel-route-multiple-times-tp5518119p5518119.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Invoking the same Camel route multiple times.

Posted by vishalad <ad...@gmail.com>.
Thanks Claus for the information. 
This information would really help me.

--
View this message in context: http://camel.465427.n5.nabble.com/Invoking-the-same-Camel-route-multiple-times-tp5518119p5521480.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Invoking the same Camel route multiple times.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The splitter EIP can do this where you can aggregate the messages
http://camel.apache.org/splitter

So it becomes like the composted message processor EIP (but without
the need for a separate aggreagator eip)
http://camel.apache.org/composed-message-processor.html

see the _Split aggregate request/reply sample_ example on the splitter eip

And you can enable the parallel processing option to enable concurrency.


On Mon, Feb 27, 2012 at 11:47 AM, vishalad <ad...@gmail.com> wrote:
> Thanks for the information.
>
> My requirement is,  I am building the list and putting it in Exchange. I
> have another route which requires single telephone number and it returns the
> data for that number. Now, I want to fetch data for all the telephone
> numbers from that list at the same time by invoking that route concurrenltly
> (like Multicast).
> Hence, I am looking for a way, where I can iterate over that list and pass
> each number to that route but at the same time for all the numbers.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Invoking-the-same-Camel-route-multiple-times-tp5518119p5518564.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Invoking the same Camel route multiple times.

Posted by vishalad <ad...@gmail.com>.
Thanks for the information.

My requirement is,  I am building the list and putting it in Exchange. I
have another route which requires single telephone number and it returns the
data for that number. Now, I want to fetch data for all the telephone
numbers from that list at the same time by invoking that route concurrenltly
(like Multicast). 
Hence, I am looking for a way, where I can iterate over that list and pass
each number to that route but at the same time for all the numbers.

--
View this message in context: http://camel.465427.n5.nabble.com/Invoking-the-same-Camel-route-multiple-times-tp5518119p5518564.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Invoking the same Camel route multiple times.

Posted by Viktor Pishchulin <i...@viktorp.com>.
Hi,
You can simply split your numbers to collection of org.apacje.camel.Message
and then pass them to desired endpoint. Something like this:

from("timer://externalServiceTimer?fixedRate=true&period=180000&delay=10000").split().
                method("externalRequestProcessorService",
"split").to(ExchangePattern.InOnly, "seda:request");
Method split in my case returns Collection<org.apache.camel.Message>.

On Mon, Feb 27, 2012 at 9:14 AM, vishalad <ad...@gmail.com> wrote:

> Hi,
>
> I have a situation in my Camel code (version 2.8) where I get the telephone
> numbers list from one camel route and that telephone numbers list size is
> not fixed (may vary). Then, i need to invoke another route for each
> telephone number in that list. So, is it possible to invoke the same route
> multiple times (over the size of the telephone numbers list) concurrently.
> And second part of it is, I need to aggregate the response of all the
> telephone numbers in one response.
>
> Does any one came across similar kind of scenario or any idea how can we
> achieve this?
> Any help would be appreciated.
>
> Thanks in advance,
> Vishal.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Invoking-the-same-Camel-route-multiple-times-tp5518119p5518119.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>