This chapter covers Akka’s tools for making applications more resilient. These tools, which follow the let-it-crash principle, are supervision, monitoring, and the actor lifecycle features. We look at examples that show how to apply them to typical failure scenarios.
NOTE
The source code for this chapter is available at www.manning.com/books/akka-in-action-second-edition or https://github.com/franciscolo pezsancho/akka-topics/tree/main/chapter05. You can find the contents of any snippet or listing in the .scala file with the same name as the class, object, or trait.
Let’s start with a definition of what we refer to here as a fault-tolerant system and why you’d write code to embrace the notion of failure. In an ideal world, a system is always available and can guarantee that it will be successful with each undertaken action. The only two paths to this ideal are using components that can never fail or accounting for every possible fault by providing a recovery action, which is also assured of success. In most architectures, what you have instead is a catch-all mechanism that terminates as soon as an uncaught failure arises.