Versions Compared

Key

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

...

InterceptFrom is for intercepting any incoming Exchange, that is in any route (it intercepts all the from DSL DSLs). This allows you to do some custom behavior for received Exchanges. You can provide a specific uri for a given Endpoint then it only applies for that particular route.

So lets start with the logging example. We want to log all the incoming requests so we use interceptFrom to route to the Log component. As proceed is default then the Exchange will continue its route, and thus it will continue to mock:first.

...

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

And if want to only apply a specific endpoint, as the seda:bar endpoint in the sample below, we can do it like this:

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

Using from Spring DSL

...