Concepts
State Hooks
State hooks are a way to add action components (tasks/notifications/metrics) dynamically to actions when a stub is in a state, when it enters a state, or when it exits a state.
Introduction
There are three available state hook types, with each type adding your specified action components dynamically to actions depending on the state hook type and the state behaviour for running the action.
in_state
: Action components are added to any action that runs while the stub is in this state.on_exit_state
: Action components are added to the action that results in exiting this state.on_enter_state
: Action components are added to the action that results in entering this state.
There can be state hooks in the "from state" and the "to state".
The multiple state hooks' action components will all be appended to the running action's action components in the order of priority above.
Here is an example scenario with example states, tasks, notifications and an action to help explain how things fit together more clearly:
When action_a
changes the state of a stub from state_a
to state_b
, the order in which action components run on that
action is as follows:
Tasks:
action_task_1
action_task_2
in_state_a_task
on_exit_state_a_task
Notifications:
action_notification_1
on_enter_state_b_notification
How to configure state hooks
See the state hooks page for more information on how to configure and use state hooks.