Finitomata.Listener behaviour (Finitomata v0.41.0)

Copy Markdown View Source

The behaviour to be implemented and passed to use Finitomata to receive all the state transitions notifications.

Summary

Callbacks

To be called when a Finitomata.on_fork/2 resolution fails.

To be called after a successful transition

Callbacks

after_fork_failure(id, state, error)

(since 0.41.0) (optional)
@callback after_fork_failure(
  id :: Finitomata.fsm_name(),
  state :: Finitomata.Transition.state(),
  error :: any()
) :: :ok

To be called when a Finitomata.on_fork/2 resolution fails.

Optional callback; implement it to be notified when the FSM reaches a fork state but the fork cannot be resolved (an unknown/ambiguous/missing fork target, a bad return, or a raise). state is the fork state and error is the resolution failure reason.

after_transition(id, state, payload)

@callback after_transition(
  id :: Finitomata.fsm_name(),
  state :: Finitomata.Transition.state(),
  payload :: Finitomata.State.payload()
) :: :ok

To be called after a successful transition