How create functionality of servlet filter using Camel

710 Views Asked by At

I need to have a route be the first and last that is executed the same as you would get using a servlet filter. Is there any way in Camel to do this so I have access to the exchange? Or possibly a way to have onCompletion only execute once right before the response is built?

1

There are 1 best solutions below

1
On

The on completion has a BeforeConsumer mode which you can use to do stuff just before the consumer writes back the response: http://camel.apache.org/oncompletion.html

And for in the start of the route, then use interceptFrom, or an event listener, or route policy or something else. There is several ways with Camel.