Chapter 8. Exception handling and logging
In this chapter
- Managing exceptions with exception strategies
- Using retry policies
- Logging with Mule
Dealing with the unexpected is an unfortunate reality when writing software. Through the use of exceptions, the Java platform provides a framework for dealing with events of this sort. Exceptions occur when unanticipated events arise in a system. These are things such as network failures, I/O issues, and authentication errors. When you control a system, you can anticipate these events and provide a means to recover from them. This luxury is often absent in a distributed integration environment. Remote applications you have no control over will fail for no apparent reason or supply malformed data. A messaging broker somewhere in your environment might begin to refuse connections. Your mail server’s disk may fill up, prohibiting you from downloading emails. Your own code might even have a bug that causes your data to be routed improperly. In any case, it’s undesirable for your entire application to fail because of a single unanticipated error.