...
intercept
that intercepts incoming ExchangeinterceptEndpoint
interceptSendToEndpoint
new in Camel 2.0 that intercepts when an Exchange is about to be sent to the given Endpoint.
...
- Predicate using
when
to only trigger the interceptor in certain conditions proceed
to continue routing from the point of interception when the interceptor is finished.proceed
is default and can be omitted.stop
when used withintercept
will stops routing the Exchange completely. Camel will by default not stop.stop
when used withinterceptEndpoint
interceptSendToEndpoint
will skip sending the Exchange to the original intended endpoint. Camel will by default not skip.
...
Wiki Markup |
---|
{snippet:id=example|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringInterceptorTest.xml} |
...
InterceptSendToEndpoint
Available as of Camel 2.0
Intercept send to endpoint is triggered when an Exchange is being sent to the intercepted endpoint. This allows you to route the Exchange to a Detour or do some custom processing before the Exchange is sent to the original intended destination. You can also skip sending to the intended destination. By default Camel will send to the original intended destination after the intercepted route completes. And as the regular intercept you can also define an when
Predicate so we only intercept if the Predicate evaluates to true. This allows you do do a bit of filtering, to only intercept when certain criteria is meet.
...
And to skip sending to the mock:foo
endpoint we use the stop()
DSL in the route at the end to instruct Camel to skip sending. The name *stop() is used as the interceptEndpoint
interceptSendToEndpoint
builds on top of intercept
and thus we inherit the DSL keywords.
...