Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The intercept feature in Camel supports intercepting Exchanges while they are on route.
We have overhauled the Intercept in Camel 2.0 so the following information is based on Camel 2.0.

Camel supports three kinds of interceptors:

  • intercept that intercepts each and every processing step while routing an Exchange in the route.
  • interceptFrom that intercepts incoming Exchange in the route.
  • interceptSendToEndpoint new in Camel 2.0 that intercepts when an Exchange is about to be sent to the given Endpoint.

...

Code Block
java
java
intercept("jms:queue:(gold|silver)").to("seda:handleFast");
Info
About dynamic and static behavior of interceptFrom and interceptSendToEndpoint
titleAbout dynamic and static behavior of interceptFrom and interceptSendToEndpoint

The interceptSendToEndpoint is dynamic hence it will also trigger if a dynamic URI is constructed that Camel was not aware of at startup time.
The interceptFrom is not dynamic as it only intercepts input to routes registered as routes in CamelContext. So if you dynamic construct a Consumer using the Camel API and consumes an Endpoint then the interceptFrom is not triggered.