Summary

Generally speaking, error handling is hard. That's why Camel provides a large panel of features around error handling. Even if you can use the doTry/doCatch/doFinally syntax, most of the time it's better to separate the routing logic from the error handling itself.

When possible, good practice is to try to recover. It's always a good idea to use strategies for recovery. It's strongly recommended to build unit tests to simulate errors. It's what we will see in the next chapter—testing with Camel.

Get Mastering Apache Camel now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.