opps - spotted type in my code.

should be

...



* .multicast()
 .to("controlbus:route?routeId=routea&action=suspend&async=true")
 .to("bean:myBean?method=setSelector(${in.header.JMSXGroupID})")
 .to("controlbus:route?routeId=routeb&action=resume&async=true")*
*...*


On Fri, 28 Feb 2020 at 09:20, nomit babraa <h.bab...@sheffield.ac.uk> wrote:

> Hi
>
> Many thanks for that.
> I have implemented a bean to be called in both routes.
>
> https://camel.apache.org/manual/latest/bean-eip.html seems to say the
> scope is Singleton as default so hopefully it's defined as singleton.
>
> (I'm using Talend to build my routes so not sure but I think each Talend
> Job is using it's own camel context and RouteBuilder class so the bean
> should also be scoped to one Talend Job.)
>
> In terms of thread safety I'm not sure if I need to do anything more than
> the below.
>
> My design is to only have one route accessing the bean at any time...
>
> My implementation is; I stop route a, pass value to bean, and start route
> b with:
>
> ...
>
>
>
> * .multicast()
>  .to("controlbus:route?routeId=routea&action=suspend&async=true")
>  .to("bean:myBean?method=setSelector(${in.header.JMSXGroupID})");
>  .to("controlbus:route?routeId=routeb&action=resume&async=true")*
> *...*
>
>
> Is the multicast order guaranteed?
>
> If so then I can be happy that everything will happen as designed
>
> Cheers
>
> n
>
>
>
> On Thu, 27 Feb 2020 at 10:05, Claus Ibsen <claus.ib...@gmail.com> wrote:
>
>> Hi
>>
>> You can use a java bean to share state, and call it from the routes,
>> just make sure the java bean is singleton scoped.
>>
>>
>> On Thu, Feb 27, 2020 at 11:01 AM nomit babraa <h.bab...@sheffield.ac.uk>
>> wrote:
>> >
>> > Hello
>> >
>> > Forgive any lack of understanding as I'm still learning.
>> >
>> > I have route A that is started and consuming from Queue1,
>> >
>> > I also have route B consuming from Queue2. This route is suspended
>> > onStart using a custom RoutePolicy.
>> >
>> > When route A gets a message, this message is consumed, processed and
>> > then the final step in Route A is to suspend itself and then resume
>> > route B.
>> >
>> > Route B wakes up and consumes messages from Queue2 using a JMS
>> > selector, processes them and then the  final step in Route B is to
>> > suspend itself and then resume route A......
>> >
>> > I'm trying to pass a variable (the selector)  from route A to route B
>> > but exchange properties and message headers, set in route A, both seem
>> > null in Route B.
>> >
>> > Is something being lost through the lifecycle management (which I do
>> > using the controlBus)?
>> >
>> > Is there a way to pass this value from route A to B?
>> >
>> >  It feels like I should want to pass it direct to keep the Scope of
>> > the variable correct.
>> >
>> >
>> >
>> > cheers
>> >
>> > n
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>
>

Reply via email to