You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by astorath <ov...@yandex.ru> on 2013/10/11 23:54:46 UTC

Apache Camel multithread processing

I want the route to operate in several thread simultainously.

from(¨timer://foo¨).to(¨jdbc://myDataSource¨).to(¨mock:results¨)

I can use two routes (timer + seda) to get that kind of result, but this is
ugly (besides using additional thread and queue), or I can create the route
several times. Is there any normal way to get that kind of behavior?



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel multithread processing

Posted by Christian Mueller <ch...@gmail.com>.
Astorath, can you please subscribe to the discussion forum as we describe
here [1]. Otherwise all your mails has to be moderate by the Camel team and
is may missed/delayed.

[1] http://camel.apache.org/discussion-forums.html

Thanks in advance,
Christian 



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383p5741446.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel multithread processing

Posted by astorath <ov...@yandex.ru>.
1. Altering the proc is not an option,
2. I need to create a transaction on per message basis.



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383p5744860.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel multithread processing

Posted by "Preben.Asmussen" <pr...@dr.dk>.
You could also change the stored proc to return a batch of messages, or use a
bean to call the stored proc. n times, and then return the result as a list
or iterator from the bean. Use the splitter to iterate over the result for
further processing.



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383p5744818.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel multithread processing

Posted by astorath <ov...@yandex.ru>.
Any updates?



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383p5744808.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel multithread processing

Posted by astorath <ov...@yandex.ru>.
I've been missing for some time...

Yeah, I've read the documentation and tried some workarounds with no luck.
The goal is as follows:
1. We have some DB Stored Procedure (GetMessage);
2. The proc works similar to JMS: it listens for for the incoming messages
for some time and returns the message or null, if the queue is empty;
3. My goal is to read next message in the queue (using this proc) and
process it;
4. The way I see it: I have to use some kind of timer (with very small
dispatch time, like 0 or 1 ms);
The timer triggers JDBC endpoint, which executes stored procedure to get
next message;

The problem is: I can't use multiple threads to execute the proc, except for
using two (or more) different routes (the only way I've found these parallel
executions to be absolutely independent). But, with different routes, I'm
unable to control total number of threads in configuration (have to rebuild
application to change number of threads).



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383p5742584.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel multithread processing

Posted by Charles Moulliard <ch...@gmail.com>.
And since Camel 2.12 we also have a new async component (like SEDA) -
http://camel.apache.org/disruptor.html using a disruptor and not
BlockingQueue of the JDK


On Sat, Oct 12, 2013 at 3:21 PM, Christian Müller <
christian.mueller@gmail.com> wrote:

> You should explain your requirements in more detail.
> Or have a look at the following sites to answer the question yourself:
> http://camel.apache.org/multicast.html
> http://camel.apache.org/seda.html
>
> Best,
> Christian
> -----------------
>
> Software Integration Specialist
>
> Apache Member
> V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
> Apache Incubator PMC Member
>
> https://www.linkedin.com/pub/christian-mueller/11/551/642
>
>
> On Fri, Oct 11, 2013 at 11:54 PM, astorath <ov...@yandex.ru> wrote:
>
> > I want the route to operate in several thread simultainously.
> >
> > from(¨timer://foo¨).to(¨jdbc://myDataSource¨).to(¨mock:results¨)
> >
> > I can use two routes (timer + seda) to get that kind of result, but this
> is
> > ugly (besides using additional thread and queue), or I can create the
> route
> > several times. Is there any normal way to get that kind of behavior?
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Re: Apache Camel multithread processing

Posted by Christian Müller <ch...@gmail.com>.
You should explain your requirements in more detail.
Or have a look at the following sites to answer the question yourself:
http://camel.apache.org/multicast.html
http://camel.apache.org/seda.html

Best,
Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Fri, Oct 11, 2013 at 11:54 PM, astorath <ov...@yandex.ru> wrote:

> I want the route to operate in several thread simultainously.
>
> from(¨timer://foo¨).to(¨jdbc://myDataSource¨).to(¨mock:results¨)
>
> I can use two routes (timer + seda) to get that kind of result, but this is
> ugly (besides using additional thread and queue), or I can create the route
> several times. Is there any normal way to get that kind of behavior?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Apache Camel multithread processing

Posted by Raul Kripalani <ra...@evosent.com>.
If you're trying to process multiple records picked up by a DB query
in parallel, you should take a look at the Splitter EIP, which
includes support for multithreading out of the box.

Regards,
Raúl.

> On 12 Oct 2013, at 01:21, astorath <ov...@yandex.ru> wrote:
>
> I want the route to operate in several thread simultainously.
>
> from(¨timer://foo¨).to(¨jdbc://myDataSource¨).to(¨mock:results¨)
>
> I can use two routes (timer + seda) to get that kind of result, but this is
> ugly (besides using additional thread and queue), or I can create the route
> several times. Is there any normal way to get that kind of behavior?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-multithread-processing-tp5741383.html
> Sent from the Camel - Users mailing list archive at Nabble.com.