Chapter 11. Finite-state machines and agents
In this chapter
- Implementing finite-state machines
- Using timers within finite-state machines
- Sharing state with agents
Previous chapters have advanced many reasons for using stateless components when implementing a system to avoid all kinds of problems, like restoring state after an error. But in most cases, there are components within a system that need state to be able to provide the required functionality. You’ve already seen two possible ways to keep state in an actor. The first is to use class variables, which we showed in our aggregator example (section 8.4.2). This is the simplest way. The second solution is to use the become/unbecome functionality, which we used in our state-dependent ...
Get Akka in Action 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.