Versions Compared

Key

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

...

Code Block
xml
xml
    <bean id="myRedeliveryPolicy" class="org.apache.camel.processor.RedeliveryPolicy">
        <property name="maximumRedeliveries" value="${myprop.max}"/>
    </bean>

     <onException>
         <!-- you can define multiple exceptions just adding more exception elements as show below -->
         <exception>com.mycompany.MyFirstException</exception>
         <exception>com.mycompany.MySecondException</exception>

         <!-- here we reference our redelivery policy defined above -->
         <redeliveryPolicy ref="myRedeliveryPolicy"/>
     </onException>

...

Asynchronous delayed redelivery

Available as of Camel 2.4

From Camel 2.4 onwards Camel will has a feature to not block while waiting for a delayed redelivery to occur (its asynchronous). However if you use transacted routes then Camel will block as its mandated by the transaction manager to execute all the work in the same thread context. You can disable enable the non blocking asynchronous behavior by the syncDelayedRedelivery option, which instructs Camel to always block while waiting. This occurs synchronously in the same thread.Since Camel by default is asynchronous for delayed redelivery it could occur that a message is to be redelivered, and while it waits, the route could pickup a new message and have it routed successfully. This can cause out of order of messaging, as the redelivered message will then be completed after that 2nd message asyncDelayedRedelivery option. This option can be set on the errorHandler, onException or the redelivery policies.

Catching multiple exceptions

...