Please find my comments inline.

Best,
Christian

On Thu, Jan 24, 2013 at 12:10 PM, BAnanth <bhavani.ana...@wipro.com> wrote:

> Hello,
>
> We have a requirement wherein we need to do some database operations
> (inserts/updates) immedialtely after the first and last routes are
> executed.
>

What do you mean?
After each exchanges was processed by the first endpoint on a route and
after each exchange was processed by the last endpoint on a route?
Or only for the first exchange?
Or...?


> We would be writing two custom interceptors - one for the insert operation
> after the first route is executed , and the other for the update operation
> once the last route is executed.
>
In org.apache.camel.processor.interceptor.DefaultTraceEventMessage you can
check how to figure out what is/was the fromEndpoint, previousNode and
nextNode. I think with this information you can determine in your
interceptor whether it should do something or not.

>
> We wanted to know if there is a way/method to know when the first route in
> camel has been executed. Likewise is there a way to find out the last route
> executed and then trigger the interceptor for updating the data in the
> database.
>
See above. May the nextNode is null if you passed the last endpoint. And
fromEndpoint and previousNode may have the same values when you pased the
first endpoint.

>
> As always, appreciate your help.
>
> Thanks and Regards,
> Bhavani
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Custom-interceptors-and-finding-the-first-and-last-camel-route-tp5726148.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Reply via email to