Multiple instances synchronization

In this example, multiple independent branches, which are executed in the multiple independent instances construct, converge at a single activity in the process. The implementation of this example involves using a loop and an asynchronous event type:

  • Each branch instance, executed in the multiple independent instances construct, ends with the throw of an asynchronous event type.

  • Following the loop that the multiple independent instances construct contains is another loop that includes a receiver for the event type. The receiver executes each time an instance of the independent activity completes.

  • A counter keeps track of the number of times the receiver is executed.

    The implementation of this example depends on whether you used gateway elements or events to implement the multiple independent instances construct.

Gateway implementation

The following illustration includes the following elements:

  • An event throw at the end of the branch in a gateway (the multiple independent instances construct)

  • An event receiver inside a loop that is used for tracking the number of branches that are complete

    Grafik in Originalgröße anzeigen
    A.
    Branch in multiple independent instances construct throws event

    B.
    Multiple instances synchronization construct receives event

    C.
    Counts number of received events

Event implementation

The following illustration shows the event throw at the end of the subprocess that is executed multiple times in the multiple instances construct. The main process receives the event inside a loop for tracking the number of subprocesses that are complete.

Grafik in Originalgröße anzeigen
A.
In the main process, multiple independent instances construct

B.
Multiple instances synchronization construct receives event

C.
Counts the number of received events

D.
In the subprocess, throws event upon completion