Chapter 5. Error handling

 

This chapter covers

  • The difference between recoverable and irrecoverable errors
  • Where and when Camel’s error handling applies
  • The different error handlers in Camel
  • Using redelivery policies
  • Handling and ignoring exceptions with onException
  • Fine-grained control of error handling

In the last three chapters, we’ve covered three key functions that any integration kit should provide: routing, transformation, and mediation. In this chapter, we turn our focus to what happens when things go wrong. We want to introduce you to error handling early in this book, because we firmly believe that error handling should not be an afterthought but a key piece in your design from the start.

Writing applications that integrate disparate systems are a challenge when it comes to handling unexpected events. In a single system that you fully control, you can handle these events and recover. But systems that are integrated over the network have additional risks: the network connection could be broken, a remote system might not respond in a timely manner, or it might even fail for no apparent reason. Even on your local server, unexpected events can occur, such as the server’s disk filling up or the server running out of memory. Regardless of which errors occur, your application should be prepared to handle them.

5.1. Understanding error handling

5.2. Error handlers in Camel

5.3. Using error handlers with redelivery

5.4. Using exception policies

5.5. Other error-handling features

5.6. Summary and best practices

sitemap