This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • How do I retry processing a message from a certain point back or an entire route

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

How do I retry processing a message from a certain point back or an entire route

By default Apache Camel will perform any redelivery (retry) attempts from the point of failure. So if you want to retry from a point before this, you would need to split up your route .

In the example above we have 2 routes (direct:start, direct:sub). In case of a failure anywhere in the direct:sub route, then the entire route is retried. This happens because we have instructed the direct:sub route to not use any error handler (eg the no error handler). Then we link the routes using the Direct component by calling the sub route from the 1st route.

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

The code above is based on an unit test, and as you can see the processor below is configured to fail the first 2 attempts.
So that means the entire direct:sub route is redeliveried, meaning that the "mock:b" endpoint receives the incoming message again.

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

The same example is shown below using the XML DSL:

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