Versions Compared

Key

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

...

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

Overriding default behavior

You can also configure the RedeliveryPolicy as this example shows

Wiki Markup
{snippet:id=e4|lang=java|url=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ErrorHandlerTest.java}

As of Camel 1.4 you can configure the ExceptionPolicyStrategy as this example shows

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

Using our own strategy MyPolicy we can change the default behavior of Camel with our own code to resolve witch ExceptionType from above should be handle the given thrown exception.

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