You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by arhan <an...@gmail.com> on 2009/08/07 15:05:08 UTC

synchronization between separate from() paths

I have 2 routes defined as follows:

configure(){
  from("sourceA").to("processorA");
  from("sourceB").to("processorB");
}

sourceB content is produced by processorA.

I have now a requirement that processorB should not start until processorA
has not finished its work, and other way raund, processorA should not start
if processorB is working.

Is there any camel-like-idioms for such case?


Probably, I could use a DelegateProcessor to wrap my processors and do
synchronizing on a shared object, but this looks kind of a hack..
-- 
View this message in context: http://www.nabble.com/synchronization-between-separate-from%28%29-paths-tp24864534p24864534.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: synchronization between separate from() paths

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

You can switch to use polling consumer and then trigger then based on
some timer.
And then check on a flag whether this route should run out not.

from(timerA).bean(a)
from(timerB).bean(b)
And then in your bean just check the flag and if its okay then poll
the sourceA and invoke processor A

Low level but practical

What could be nice is that the from() in Camel could have a onWhen or
the likes that can allow fine grained control when it should be
running.

Anyway that stuff is for Camel 2.x.



On Fri, Aug 7, 2009 at 3:05 PM, arhan<an...@gmail.com> wrote:
>
> I have 2 routes defined as follows:
>
> configure(){
>  from("sourceA").to("processorA");
>  from("sourceB").to("processorB");
> }
>
> sourceB content is produced by processorA.
>
> I have now a requirement that processorB should not start until processorA
> has not finished its work, and other way raund, processorA should not start
> if processorB is working.
>
> Is there any camel-like-idioms for such case?
>
>
> Probably, I could use a DelegateProcessor to wrap my processors and do
> synchronizing on a shared object, but this looks kind of a hack..
> --
> View this message in context: http://www.nabble.com/synchronization-between-separate-from%28%29-paths-tp24864534p24864534.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: synchronization between separate from() paths

Posted by Hadrian Zbarcea <hz...@gmail.com>.
You should use camel-bam for such requirements.

Hadrian

On Aug 7, 2009, at 9:05 AM, arhan wrote:

>
> I have 2 routes defined as follows:
>
> configure(){
>  from("sourceA").to("processorA");
>  from("sourceB").to("processorB");
> }
>
> sourceB content is produced by processorA.
>
> I have now a requirement that processorB should not start until  
> processorA
> has not finished its work, and other way raund, processorA should  
> not start
> if processorB is working.
>
> Is there any camel-like-idioms for such case?
>
>
> Probably, I could use a DelegateProcessor to wrap my processors and do
> synchronizing on a shared object, but this looks kind of a hack..
> -- 
> View this message in context: http://www.nabble.com/synchronization-between-separate-from%28%29-paths-tp24864534p24864534.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>