Agenda Groups
Agenda groups allow for logical groups of rules within a flow.
The agenda manages a stack
of agenda-groups
that are currently in focus. The default agenda-group
is called main
and all rules that do not have an agenda-group
specified are placed into the main
agenda-group
.
As rules are fired and a particular agenda-group
runs out of activations then that agenda-group
is popped from the internal agenda-group
stack and the next one comes into focus. This continues until focus
is explicitly called again or the main
agenda-group
comes into focus.
Note Once an agenda group loses focus it must be re-added to the stack in order for those activations to be focused again.
To add a rule to an agenda-group you can use the agendaGroup
option.
Or in the dsl
In the above rules we have defined two agenda-groups called ag1
and ag2
Focus
When running your rules and you want a particular agenda group to run you must call focus
on the session of the flow and specify the agenda-group
to add to the stack.
Or you can add multiple agenda-groups
to the focus stack.
Notice above that the last agenda-group
focused is added to the array first.
Auto Focus
Sometimes you may want an agenda-group
to auto-focus
whenever a certain rule is activated.
Or using the dsl
In the above rules we created a state machine that has a rule with auto-focus
set to true.
This allows you to not have to specify focus
when running the flow.