You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Max Bridgewater <ma...@gmail.com> on 2014/06/06 12:11:40 UTC

Async and UnitOfWork

Hi,

I have a restlet route that triggers SEDA and VM routes. The unit of work
is used to do some transformation of the result before it is sent to the
HTTP client. It works fine as long as there is no SEDA or VM. As soon as
the latter two are included, the unit of work is not executed anymore.

This seems to be related to the following thread:
http://grokbase.com/t/camel/users/13856jw2j0/unit-of-work-scope-and-direct-seda-vm-components

My question: how can I tell camel to simply ignore async routes such that
they do not impact unit of work.

Thanks.
Max.

Re: Async and UnitOfWork

Posted by "kraythe ." <kr...@gmail.com>.
Futures allow asynch programming without waiting on a result that might
take a while. If Camel supported them an exchange could collect futures and
would only have to wait for the actual values when he contents of the
futures were used. This would make for powerful asynch features.

Look up Java Futures on google or java.util.concurrent API for more info.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Fri, Jun 6, 2014 at 2:31 PM, Max Bridgewater <ma...@gmail.com>
wrote:

> I think wire tap actually serves me well. I have NOT verified that the
> execution of the SEDA route happens asynchronous when I set
> waitForTaskToComplete
> to Never. For now, I give it the benefit of the doubt ;). How would use
> futures be different from wire tapping?
>
> Thanks a lot.
>
>
> On Fri, Jun 6, 2014 at 3:21 PM, kraythe . <kr...@gmail.com> wrote:
>
> > It would be interesting to implement asynch and share unit of work by way
> > of futures in the ... well ... future. :) But currently you cant really
> do
> > that. What you need are transactions. The problem is SEDA doesn't support
> > transactions. So what you need is JMS.
> >
> > *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> > *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> > *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
> > <http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
> >
> >
> > On Fri, Jun 6, 2014 at 6:00 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> > > Hi
> > >
> > > Maybe its the wire tap eip you should use.
> > >
> > > On Fri, Jun 6, 2014 at 12:38 PM, Max Bridgewater
> > > <ma...@gmail.com> wrote:
> > > > Hi Claus,
> > > >
> > > > Thanks for your input. Do you suggest to use synchronous flag  on the
> > > SEDA
> > > > and VM producers? They have a  flag waitForTaskToComplete that I
> > curretly
> > > > set to Never. Indeed if I set these flags to Always, the processing
> > > becomes
> > > > synchronous and everything works fine. The challenge is that these
> SEDA
> > > and
> > > > VM tasks take long to complete and I do not want them to impact
> > response
> > > > time. So, the question thus is if I can still have the SEDA and VM
> > > process
> > > > asynchronously and ignore by Unit of Work.
> > > >
> > > > Regards,
> > > > Max.
> > > >
> > > >
> > > > On Fri, Jun 6, 2014 at 6:16 AM, Claus Ibsen <cl...@gmail.com>
> > > wrote:
> > > >
> > > >> Hi
> > > >>
> > > >> You can set the synchronous option. See
> > > >> http://camel.apache.org/asynchronous-routing-engine.html
> > > >>
> > > >> On Fri, Jun 6, 2014 at 12:11 PM, Max Bridgewater
> > > >> <ma...@gmail.com> wrote:
> > > >> > Hi,
> > > >> >
> > > >> > I have a restlet route that triggers SEDA and VM routes. The unit
> of
> > > work
> > > >> > is used to do some transformation of the result before it is sent
> to
> > > the
> > > >> > HTTP client. It works fine as long as there is no SEDA or VM. As
> > soon
> > > as
> > > >> > the latter two are included, the unit of work is not executed
> > anymore.
> > > >> >
> > > >> > This seems to be related to the following thread:
> > > >> >
> > > >>
> > >
> >
> http://grokbase.com/t/camel/users/13856jw2j0/unit-of-work-scope-and-direct-seda-vm-components
> > > >> >
> > > >> > My question: how can I tell camel to simply ignore async routes
> such
> > > that
> > > >> > they do not impact unit of work.
> > > >> >
> > > >> > Thanks.
> > > >> > Max.
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> Claus Ibsen
> > > >> -----------------
> > > >> Red Hat, Inc.
> > > >> Email: cibsen@redhat.com
> > > >> Twitter: davsclaus
> > > >> Blog: http://davsclaus.com
> > > >> Author of Camel in Action: http://www.manning.com/ibsen
> > > >> hawtio: http://hawt.io/
> > > >> fabric8: http://fabric8.io/
> > > >>
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > Red Hat, Inc.
> > > Email: cibsen@redhat.com
> > > Twitter: davsclaus
> > > Blog: http://davsclaus.com
> > > Author of Camel in Action: http://www.manning.com/ibsen
> > > hawtio: http://hawt.io/
> > > fabric8: http://fabric8.io/
> > >
> >
>

Re: Async and UnitOfWork

Posted by Max Bridgewater <ma...@gmail.com>.
I think wire tap actually serves me well. I have NOT verified that the
execution of the SEDA route happens asynchronous when I set
waitForTaskToComplete
to Never. For now, I give it the benefit of the doubt ;). How would use
futures be different from wire tapping?

Thanks a lot.


On Fri, Jun 6, 2014 at 3:21 PM, kraythe . <kr...@gmail.com> wrote:

> It would be interesting to implement asynch and share unit of work by way
> of futures in the ... well ... future. :) But currently you cant really do
> that. What you need are transactions. The problem is SEDA doesn't support
> transactions. So what you need is JMS.
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
> <http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
>
>
> On Fri, Jun 6, 2014 at 6:00 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
> > Hi
> >
> > Maybe its the wire tap eip you should use.
> >
> > On Fri, Jun 6, 2014 at 12:38 PM, Max Bridgewater
> > <ma...@gmail.com> wrote:
> > > Hi Claus,
> > >
> > > Thanks for your input. Do you suggest to use synchronous flag  on the
> > SEDA
> > > and VM producers? They have a  flag waitForTaskToComplete that I
> curretly
> > > set to Never. Indeed if I set these flags to Always, the processing
> > becomes
> > > synchronous and everything works fine. The challenge is that these SEDA
> > and
> > > VM tasks take long to complete and I do not want them to impact
> response
> > > time. So, the question thus is if I can still have the SEDA and VM
> > process
> > > asynchronously and ignore by Unit of Work.
> > >
> > > Regards,
> > > Max.
> > >
> > >
> > > On Fri, Jun 6, 2014 at 6:16 AM, Claus Ibsen <cl...@gmail.com>
> > wrote:
> > >
> > >> Hi
> > >>
> > >> You can set the synchronous option. See
> > >> http://camel.apache.org/asynchronous-routing-engine.html
> > >>
> > >> On Fri, Jun 6, 2014 at 12:11 PM, Max Bridgewater
> > >> <ma...@gmail.com> wrote:
> > >> > Hi,
> > >> >
> > >> > I have a restlet route that triggers SEDA and VM routes. The unit of
> > work
> > >> > is used to do some transformation of the result before it is sent to
> > the
> > >> > HTTP client. It works fine as long as there is no SEDA or VM. As
> soon
> > as
> > >> > the latter two are included, the unit of work is not executed
> anymore.
> > >> >
> > >> > This seems to be related to the following thread:
> > >> >
> > >>
> >
> http://grokbase.com/t/camel/users/13856jw2j0/unit-of-work-scope-and-direct-seda-vm-components
> > >> >
> > >> > My question: how can I tell camel to simply ignore async routes such
> > that
> > >> > they do not impact unit of work.
> > >> >
> > >> > Thanks.
> > >> > Max.
> > >>
> > >>
> > >>
> > >> --
> > >> Claus Ibsen
> > >> -----------------
> > >> Red Hat, Inc.
> > >> Email: cibsen@redhat.com
> > >> Twitter: davsclaus
> > >> Blog: http://davsclaus.com
> > >> Author of Camel in Action: http://www.manning.com/ibsen
> > >> hawtio: http://hawt.io/
> > >> fabric8: http://fabric8.io/
> > >>
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: cibsen@redhat.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> > hawtio: http://hawt.io/
> > fabric8: http://fabric8.io/
> >
>

Re: Async and UnitOfWork

Posted by "kraythe ." <kr...@gmail.com>.
It would be interesting to implement asynch and share unit of work by way
of futures in the ... well ... future. :) But currently you cant really do
that. What you need are transactions. The problem is SEDA doesn't support
transactions. So what you need is JMS.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Fri, Jun 6, 2014 at 6:00 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Maybe its the wire tap eip you should use.
>
> On Fri, Jun 6, 2014 at 12:38 PM, Max Bridgewater
> <ma...@gmail.com> wrote:
> > Hi Claus,
> >
> > Thanks for your input. Do you suggest to use synchronous flag  on the
> SEDA
> > and VM producers? They have a  flag waitForTaskToComplete that I curretly
> > set to Never. Indeed if I set these flags to Always, the processing
> becomes
> > synchronous and everything works fine. The challenge is that these SEDA
> and
> > VM tasks take long to complete and I do not want them to impact response
> > time. So, the question thus is if I can still have the SEDA and VM
> process
> > asynchronously and ignore by Unit of Work.
> >
> > Regards,
> > Max.
> >
> >
> > On Fri, Jun 6, 2014 at 6:16 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> Hi
> >>
> >> You can set the synchronous option. See
> >> http://camel.apache.org/asynchronous-routing-engine.html
> >>
> >> On Fri, Jun 6, 2014 at 12:11 PM, Max Bridgewater
> >> <ma...@gmail.com> wrote:
> >> > Hi,
> >> >
> >> > I have a restlet route that triggers SEDA and VM routes. The unit of
> work
> >> > is used to do some transformation of the result before it is sent to
> the
> >> > HTTP client. It works fine as long as there is no SEDA or VM. As soon
> as
> >> > the latter two are included, the unit of work is not executed anymore.
> >> >
> >> > This seems to be related to the following thread:
> >> >
> >>
> http://grokbase.com/t/camel/users/13856jw2j0/unit-of-work-scope-and-direct-seda-vm-components
> >> >
> >> > My question: how can I tell camel to simply ignore async routes such
> that
> >> > they do not impact unit of work.
> >> >
> >> > Thanks.
> >> > Max.
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> Red Hat, Inc.
> >> Email: cibsen@redhat.com
> >> Twitter: davsclaus
> >> Blog: http://davsclaus.com
> >> Author of Camel in Action: http://www.manning.com/ibsen
> >> hawtio: http://hawt.io/
> >> fabric8: http://fabric8.io/
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>

Re: Async and UnitOfWork

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

Maybe its the wire tap eip you should use.

On Fri, Jun 6, 2014 at 12:38 PM, Max Bridgewater
<ma...@gmail.com> wrote:
> Hi Claus,
>
> Thanks for your input. Do you suggest to use synchronous flag  on the SEDA
> and VM producers? They have a  flag waitForTaskToComplete that I curretly
> set to Never. Indeed if I set these flags to Always, the processing becomes
> synchronous and everything works fine. The challenge is that these SEDA and
> VM tasks take long to complete and I do not want them to impact response
> time. So, the question thus is if I can still have the SEDA and VM process
> asynchronously and ignore by Unit of Work.
>
> Regards,
> Max.
>
>
> On Fri, Jun 6, 2014 at 6:16 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> You can set the synchronous option. See
>> http://camel.apache.org/asynchronous-routing-engine.html
>>
>> On Fri, Jun 6, 2014 at 12:11 PM, Max Bridgewater
>> <ma...@gmail.com> wrote:
>> > Hi,
>> >
>> > I have a restlet route that triggers SEDA and VM routes. The unit of work
>> > is used to do some transformation of the result before it is sent to the
>> > HTTP client. It works fine as long as there is no SEDA or VM. As soon as
>> > the latter two are included, the unit of work is not executed anymore.
>> >
>> > This seems to be related to the following thread:
>> >
>> http://grokbase.com/t/camel/users/13856jw2j0/unit-of-work-scope-and-direct-seda-vm-components
>> >
>> > My question: how can I tell camel to simply ignore async routes such that
>> > they do not impact unit of work.
>> >
>> > Thanks.
>> > Max.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: cibsen@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>> hawtio: http://hawt.io/
>> fabric8: http://fabric8.io/
>>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Async and UnitOfWork

Posted by Max Bridgewater <ma...@gmail.com>.
Hi Claus,

Thanks for your input. Do you suggest to use synchronous flag  on the SEDA
and VM producers? They have a  flag waitForTaskToComplete that I curretly
set to Never. Indeed if I set these flags to Always, the processing becomes
synchronous and everything works fine. The challenge is that these SEDA and
VM tasks take long to complete and I do not want them to impact response
time. So, the question thus is if I can still have the SEDA and VM process
asynchronously and ignore by Unit of Work.

Regards,
Max.


On Fri, Jun 6, 2014 at 6:16 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> You can set the synchronous option. See
> http://camel.apache.org/asynchronous-routing-engine.html
>
> On Fri, Jun 6, 2014 at 12:11 PM, Max Bridgewater
> <ma...@gmail.com> wrote:
> > Hi,
> >
> > I have a restlet route that triggers SEDA and VM routes. The unit of work
> > is used to do some transformation of the result before it is sent to the
> > HTTP client. It works fine as long as there is no SEDA or VM. As soon as
> > the latter two are included, the unit of work is not executed anymore.
> >
> > This seems to be related to the following thread:
> >
> http://grokbase.com/t/camel/users/13856jw2j0/unit-of-work-scope-and-direct-seda-vm-components
> >
> > My question: how can I tell camel to simply ignore async routes such that
> > they do not impact unit of work.
> >
> > Thanks.
> > Max.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>

Re: Async and UnitOfWork

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

You can set the synchronous option. See
http://camel.apache.org/asynchronous-routing-engine.html

On Fri, Jun 6, 2014 at 12:11 PM, Max Bridgewater
<ma...@gmail.com> wrote:
> Hi,
>
> I have a restlet route that triggers SEDA and VM routes. The unit of work
> is used to do some transformation of the result before it is sent to the
> HTTP client. It works fine as long as there is no SEDA or VM. As soon as
> the latter two are included, the unit of work is not executed anymore.
>
> This seems to be related to the following thread:
> http://grokbase.com/t/camel/users/13856jw2j0/unit-of-work-scope-and-direct-seda-vm-components
>
> My question: how can I tell camel to simply ignore async routes such that
> they do not impact unit of work.
>
> Thanks.
> Max.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/