Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
Próxima SlideShare
Cargando en…5
×

# Akka Finite State Machine

1.561 visualizaciones

In Actors system, we can change State or Behaviors during runtime in actors. There are multiple ways for changing behaviors like conditional based and Hotswap but Finite State Machine(FSM) is the cleanest way. If we have finite number of state in our system then FSM is the good practice.

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Sé el primero en comentar

• Sé el primero en recomendar esto

### Akka Finite State Machine

1. 1. By: Harmeet Singh (Taara) Software Consultant
2. 2. Agenda 1. Actor Model/Akka (Brief) . 2. Finite State Machine (FSM) 3. Demo. 4. Leftover: The things we didn’t cover
3. 3. ActorModel:Fundamentals ➔ All Computations is performed within Actor. ➔ Actors can communicate only through messages. NOTE: Modeling a software this allows you to deal with state in an atomic way, isolated way which is core principal of actor model.
4. 4. ActorModel:Fundamentals ➔ In response to a message, an actors can: – Change its State or Behavior – Send message to other actors. – Create a finite number of child's
5. 5. ActorModel:Fundamentals -Actors can change their State or Behavior ➔ Each behavior in the system can represent a state, and the actor can move from one state to the next when its receives a message. There are few mechanism we can use to change behavior in the face of different states: – Conditional Based on an Actor State. – Hotswat: become() and unbecome(). – Finite State Machine (FSM).
6. 6. FiniteStateMachine(FSM): -Actors can change their State or Behavior If we are in state S and the event E occurs, we should perform the actions A and make a transition to the state S'. State(S) x Event(E) -> Actions (A), State(S')
7. 7. Finite State Machine (FSM) ➔ Common language independent modeling technique. ➔ FSM is defined by a number of states and the different triggers for all possible transitions. ➔ Transitions are only happen when the machine is trigger by an event. ➔ Event in an Akka FSM are the messages that actor received.
8. 8. FiniteStateMachine(FSM): -Visualize FSM
9. 9. FiniteStateMachine(FSM) –Case Study: Inventory System
10. 10. FiniteStateMachine(FSM) Case Study: Inventory System Akka-FSM
11. 11. FiniteStateMachine(FSM) -User Cases ➔ Change actors behaviors according to state. ➔ Perform transitions during actor state change. ➔ Finite number of states. ➔ Model pure actor model using DDD.
12. 12. Leftover:Thethingswedidn’tcover ➔ Shared state with Agents. ➔ Akka persistence. ➔ Actor Model with DDD (Domain Driven Design). ➔ Akka best Practices.
13. 13. References: ➔ Applied Akka Patterns By Michael Nash and Wade Waldron. ➔ Learning Akka By Jason Goodwin. ➔ Akka in Action By Raymond Roestenburg (Author) , Rob Bakker (Author) and Rob W