Versions Compared

Key

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

...

Both of these interceptors supports

  • Predicat 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 with intercept will stops routing the Exchange completely. Camel will by default not stop.
  • stop when used with interceptEndpoint will skip sending the Exchange to the original intended endpoint. Camel will by default not skip.

...

Wiki Markup
{snippet:id=e3|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/InterceptEndpointTest.java}

Using from Spring DSL

Intercept endpoint is of course also available using Spring DSL.

We start with the first example from above in Spring DSL:

Wiki Markup
{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/interceptendpoint.xml}

And the 2nd. Notice how we can leverage the Simple language for the Predicate:

Wiki Markup
{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/interceptendpointwhen.xml}

And the 3rd with the stop:

Wiki Markup
{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/interceptendpointskip.xml}