<sequence>
<participant ref="alice" />
<concurrent-iterator
on-field-value="iteration_list"
to-field="__subject__"
>
<participant ref="bob" />
</concurrent-iterator>
</sequence>
Another way to apply the 'concurrent-iterator', here the participant alice may define a field named 'iteration_list' whose content may be a StringAttribute of value 'alpha, bravo, charly, delta'.
When the concurrent-iterator is evaluated, this field's value is turned into an iteration list. Four workitems will be passed to participant bob, with their field '__subject__' put respectively to 'alpha', 'bravo', 'charly' and 'delta'.
Note that the delimiter for the value is ',' by default, but you can set with something like :
<concurrent-iterator
on-field-value="iteration_list"
to-field="__subject__"
value-separator="; *"
>
where ';' is the separator. Note that this is a regular expression.
The concurrent-iterator supports the same sync expressions as concurrence (see pattern #3)
Concurrent-iterator is the child of the 'iterator' expression. Iterator is as sequential as concurrent-iterator is parallel.
So you could have three sequential reviews with something like :
<iterator
on-value="initial review; second review; final review"
to-field="__subject__"
value-separator="; *"
>
<sequence>
<participant ref="review_team" />
<participant ref="post_review_team" />
</sequence>
</iterator>
One important thing to note here, is that the iterator expression has only one child, which is a sequence expression. If the iterator expression had other children, they would get discarded (never interpreted as expressions).
Iterator and concurrent-iterator only use one child (you can supply it with a concurrence or a sequence of course).
Note : instead of 'to-field', you can also use 'to-variable', but remember that variable are not visible outside of the engine that sets them.
One can iterate over fields that are of type ListAttribute or MapAttribute (StringMapAttribute too of course). Iterating over a MapAttribute instance will iterate over the values (not over the keys).
Within an 'iterator' or a 'concurrent-iterator', the field '__ip__' is set to the index of the child currently behind executed.
<iterator
on-value="alice, bob, charly"
to-field="username"
>
<sequence>
<set field="index" field-value="__ip__" />
<participant ref="user-${f:username}" />
</sequence>
</iterator>
In that example, the participant 'user-alice' will receive a workitem whose field 'index' is set to '0'.