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 router (section 9.3.2). These two mechanisms are the more basic ways to implement state. But in some situations, these solutions are insufficient.

11.1. Using a finite-state machine

 
 
 

11.2. Implementation of an FSM model

 
 
 

11.3. Implement shared state using agents

 
 

11.4. Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage