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

Camel error handlers


As we saw, Camel stores the exceptions in the exchange using the setException(Throwable cause) method.

Camel provides ready-to-use error handlers, depending of the mechanism that you have to implement. These error handlers will only react to the exceptions set in the exchange. By default, the error handlers won't react if an irrecoverable error has been set as the fault message. We will see, further in the chapter, that Camel provides an option to handle irrecoverable errors.

In order to react, the error handler lives on the route channels. Actually, an error handler is an interceptor (on the channel), that analyzes the exchange, and verifies that the exception attribute of the exchange is not null.

If the exception is not null, the error handler reacts. This means that the error handler will catch any uncaught exception thrown during the routing or processing of messages within Camel.

Camel provides different kinds of error handlers, depending on your need.

Non-transacted...