Ok, we will try this. I will let you know whether it works for us or not.

Have a nice weekend,
Christian


On Thu, Apr 4, 2013 at 11:59 PM, Raul Kripalani <r...@evosent.com> wrote:

> Yes, that's exactly how I would go about it. When I said "Exchange
> Notifier", I actually meant "Event Notifier".
>
> Just extend EventNotifierSupport and enable the Exchange Failed and
> Exchange Completed events. Make them react accordingly by calling either
> the onFailure or onComplete method of the IdempotentOnCompletion
> Synchronization present on the Exchange.
>
> Worse comes to worst, if you don't manage to get it working like this, you
> can consider extending IdempotentConsumer and pluging it in as a normal
> Processor in your route. Within it, instead of injecting a Synchronization,
> add the messageId to the idempotent repository from inside an AsyncCallback
> that wraps the original one.
>
> It will then execute synchronously as the route unwinds and the
> AsyncCallbacks are called.
>
> Regards,
>
> *Raúl Kripalani*
> Enterprise Architect, Open Source Integration specialist, Program
> Manager | Apache
> Camel Committer
> http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
> http://blog.raulkr.net | twitter: @raulvk
>
> On Thu, Apr 4, 2013 at 8:58 PM, Christian Müller <
> christian.muel...@gmail.com> wrote:
>
> > Have in mind the IdempotentConsumer registers an IdempotentOnCompletion
> for
> > each new added exchange in the repository.
> >
> > Will the following work?:
> > We register an EventNotifier which will react on failed exchanges for a
> > give route. This custom EventNotifier is executed before the
> > onCompleation() is executed. So we can remove the IdempotentOnCompletion
> > from the exchange in our custom EventNotifier after we have executed it
> > synchronous. Right?
> >
> > Best,
> > Christian
> >
> >
> > On Thu, Apr 4, 2013 at 5:37 PM, Raul Kripalani <r...@evosent.com> wrote:
> >
> > > BTW - In this Exchange Notifier, I suppose you'd call
> > > Exchange.handoverCompletions() to retrieve the Synchronizations, and
> then
> > > execute them straightaway.
> > >
> > > But I'm not 100% sure. Just a suggestion.
> > >
> > > Regards,
> > >
> > > *Raúl Kripalani*
> > > Enterprise Architect, Open Source Integration specialist, Program
> > > Manager | Apache
> > > Camel Committer
> > > http://about.me/raulkripalani |
> http://www.linkedin.com/in/raulkripalani
> > > http://blog.raulkr.net | twitter: @raulvk
> > >
> > > On Thu, Apr 4, 2013 at 4:28 PM, Raul Kripalani <r...@evosent.com>
> wrote:
> > >
> > > > Hi Christian,
> > > >
> > > > I solved this once by using an ExchangeNotifier that processes the
> > > > Exchange Completed events.
> > > > The callback is executed synchronously.
> > > >
> > > > Mind you, there was a similar thread a few weeks ago, where more
> > options
> > > > were presented. But I'm still doubtful about some of them being
> > > synchronous
> > > > (and I haven't had time to dig into the code to verify it).
> > > >
> > > > Regards,
> > > >
> > > > *Raúl Kripalani*
> > > > Enterprise Architect, Open Source Integration specialist, Program
> > Manager
> > > > | Apache Camel Committer
> > > > http://about.me/raulkripalani |
> > http://www.linkedin.com/in/raulkripalani
> > > > http://blog.raulkr.net | twitter: @raulvk
> > > >
> > > > On Thu, Apr 4, 2013 at 4:22 PM, Christian Müller <
> > > > christian.muel...@gmail.com> wrote:
> > > >
> > > >> Camel version 2.8.0
> > > >>
> > > >> We have a web servive route which use an idempotent repository
> (JDBC)
> > to
> > > >> prevent duplicates. If the processing of one exchange failed, the
> > entry
> > > is
> > > >> removed from the idempotent repository in the async onCompleation()
> > > >> execution.
> > > >>
> > > >> From time to time we have the issue, that when the client send the
> > > request
> > > >> again after only a few milli seconds, the entry wasn't removed from
> > the
> > > >> repository and processed as a duplicate.
> > > >>
> > > >> Is there a way to process the onCompleation() synchronously (before
> > the
> > > >> web
> > > >> service response is send back)?
> > > >>
> > > >> Thanks in advance,
> > > >> Christian
> > > >>
> > > >
> > > >
> > >
> >
>

Reply via email to