Handling undetermined number of events


#1

Hi!

How to handle multiple events correctly if number of event producers is undetermined in common case?

Example:

Suppose we have 2 process definitions: Service1 activation and Service2 activation.
Service1 activation should be done after all Service2 are activated. Number of ordered Service2 can vary from 0 to N.

image

Tried to receive event, check condition on counter and exit to empty task if counter doesn’t match necessary value, but such approach leads to multiple excess ugly elements in process and requires to adjust counter value for each of N possible configurations.

Is there stylish solution?


#2

How do you know what is the last event? (what data do you have/get/can calculate that says its the last event?)


#3

Each time next event is received - maybe its possible to check number of process instances running which haven’t sent event yet.
I understand that calculation logic can be tricky (for instance if there is conditional gateway before throwing event).


#4

@JustMormegil but what is the business logic to calculate what is the final event? Not the technical solution; rather logically how do you know what is the final message?


#5

There can be any number of Service2 process instances ordered with single Service1 process instance, Service2 process instances are executed simultaniously in undetermined order and can send ‘activation done’ event in any order. The last one been sent is final.