camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Bridgewater <max.bridgewa...@gmail.com>
Subject Re: UnitOfWork in Camel 2.14
Date Thu, 02 Oct 2014 11:45:10 GMT
Thanks for all the input. Much appreciated. I think I found an alternate
explanation: the synchronization is being called for each sub-route.

So, with the hello chain below, the synchronization is called for
servlet:///bye, for direct:hello1, and for direct:hello2. To address this,
I execute the onAfterRoute body only if the end point contains servlet.

Does that sound right? It seems to address my issue.

<get uri="/bye">
   <to uri="direct:hello1"/>
</get>
<route>
    <from uri="direct:hello1"/>
    <to uri="direct:hello2"
</route>

<route>
    <from uri="direct:hello2"/>
    <transform><constant>Hello</constant></transform>
</route>


On Thu, Oct 2, 2014 at 4:24 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> javadoc is the main documentation of apis in java.
>
> But you are welcome to knock yourself on the Camel wiki if you like
> http://camel.apache.org/oncompletion.html
>
> On Thu, Oct 2, 2014 at 10:16 AM, Charles Moulliard <ch007m@gmail.com>
> wrote:
> > That should be documented somewhere (maybe page oncompletion.html) as the
> > javadoc is not sufficient enough as source of information for the end
> users.
> >
> >
> > On Thu, Oct 2, 2014 at 9:33 AM, Claus Ibsen <claus.ibsen@gmail.com>
> wrote:
> >
> >> No please read the javadoc of
> >> org.apache.camel.spi.SynchronizationRouteAware
> >>
> >> Its called 3 times because
> >> - before routing
> >> - after route
> >> - done (either onComplete or onFailure)
> >>
> >> On Thu, Oct 2, 2014 at 9:17 AM, Charles Moulliard <ch007m@gmail.com>
> >> wrote:
> >> > Hi Max,
> >> >
> >> > Is it called 3 times because an exception has been throw in the route
> ?
> >> Do
> >> > you have a test case that we could use to have a look and reproduce
> the
> >> > issue ?
> >> >
> >> > Regards,
> >> >
> >> >
> >> > On Thu, Oct 2, 2014 at 5:21 AM, Max Bridgewater <
> >> max.bridgewater@gmail.com>
> >> > wrote:
> >> >
> >> >> Some progress on this. It appears that in Camel 2.14, there is now
an
> >> >> interface called SynchronizationRouteAware in addition to
> >> Synchronization.
> >> >> SynchronizationRouteAwarehas two additional methods onAfterRoute and
> >> >> onBeforeRoute.
> >> >>
> >> >> What I've done is implement onAfterRoute and call my completion logic
> >> >> there. I left onComplete and onBeforeRoute empty.
> >> >>
> >> >> Things seem to work well and the synchronization is called at the
> end of
> >> >> the route as it was the case with Camel 2.13. The only caveat now is
> >> that
> >> >> the synchronization is being called 3 times instead of just once.
> >> >>
> >> >> Why is this?
> >> >>
> >> >> My Synchronization looks as follows:
> >> >>
> >> >> exchange.getUnitOfWork().addSynchronization(
> >> >>                             SynchronizationRouteAware(){
> >> >>                         public void onAfterRoute(Route route,
> >> Exchange
> >> >> exchange){
> >> >>                                 myCompletionLogic(exchange)
> >> >>                         }
> >> >>                         public void onBeforeRoute(Route route,
> Exchange
> >> >> exchange){
> >> >>                             //Left Empty
> >> >>                         }
> >> >>                         public void      myCompletionLogic(Exchange
> x){
> >> >>                             //My completion logic here
> >> >>                         }
> >> >>                         public void      onComplete(Exchange x){
> >> >>                             //Left empty
> >> >>                         }
> >> >>                         public void      onFailure(Exchange x){
> >> >>                             //Left empty
> >> >>                         }
> >> >>
> >> >>                             }
> >> >>
> >> >>                         );
> >> >>
> >> >> On Wed, Oct 1, 2014 at 2:35 PM, Max Bridgewater <
> >> max.bridgewater@gmail.com
> >> >> >
> >> >> wrote:
> >> >>
> >> >> > Hi,
> >> >> >
> >> >> > In Came 2.14, onCompletion now has a mode parameter that allows
> >> >> > controlling if the onCompletion body is to be executed after or
> before
> >> >> the
> >> >> > route consumer.
> >> >> >
> >> >> > How does this impact UnitOfWork? Is there a way to also control
> when a
> >> >> > synchronization is to be executed?
> >> >> >
> >> >> > I haven't fully isolated the issue yet. But I seem to have a case
> >> where
> >> >> > UnitOfWork was executed before the route consumer while with Camel
> >> 2.14,
> >> >> it
> >> >> > is not executed after the route consumer has started.
> >> >> >
> >> >> > Any thoughts?
> >> >> >
> >> >> > Regards,
> >> >> > Max.
> >> >> >
> >> >> >
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Charles Moulliard
> >> > Apache Committer / Architect @RedHat
> >> > Twitter : @cmoulliard | Blog :  http://cmoulliard.github.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/
> >>
> >
> >
> >
> > --
> > Charles Moulliard
> > Apache Committer / Architect @RedHat
> > Twitter : @cmoulliard | Blog :  http://cmoulliard.github.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/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message