Book Image

Mastering Apache Camel

By : Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré
5 (1)
Book Image

Mastering Apache Camel

5 (1)
By: Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré

Overview of this book

Table of Contents (15 chapters)
Mastering Apache Camel
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Error handler features


Basically, all error handlers extend the DefaultErrorHandler. The DefaultErrorHandler provides a set of interesting features allowing you to use very fine-grained management of the exceptions.

Redelivery

The DefaultErrorHandler (and so the DeadLetterErrorHandler and TransactedErrorHandler) supports a redelivery mechanism that you can configure via a redelivery policy.

For instance, the following Blueprint XML creates a Camel route that systematically throws an IllegalArgumentException (with Booooommmmm message). As we don't explicitly define an error handler, the route uses the DefaultErrorHandler. We just configure the redelivery policy of the DefaultErrorHandler, trying to redeliver the message three times, waiting two seconds between each attempt. If it still fails at the fourth attempt, the exchange ends and the exception is sent to the caller.

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">

  <bean...