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 <[email protected]>
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 <[email protected]
> >
> 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

Reply via email to