I’m new to the world of BPMN 2.0 and a bit overwhelmed with number of available components and constructs.
I’m looking for help to model a pretty complicated workflow:
A single process has an “event loop” that captures task event from an external system, then it submits the task asynchronously for execution to the external system and awaits for its completion status though POST rest callback mechanism. Any number of such tasks events can come in until a specific message is received that marks the end of task list. At this point the main process should check if all asynchronously submitted tasks have completed or wait for still running tasks to complete. If any of tasks failed then the whole process should be marked as failed.
Overview: So basically you start the process by hand/manually, and you would use two “messages”. One message which is the Task message and the other message that says to end the process.
The parent process would be waiting for the end message, and the Event-Sub-Process (the dotted line) would wait for any message for the External Task Work (The task sent to the external system/server). The Event-Sub-Process would be non-interrupting, so it would continue to be available for use until the parent process reached the End Event, and all the Event-Sub-Processes reached their End Events.
Depending on how you want to mark a failure (if a failure on a single task occurs, do you want to kill all activate activity?), there is another variation:
Overview: In this second example if a Task fails, then a Signal is sent out which the parent process would catch and activate the Terminate End Event which would kill any activate sub-processes. You could probably switch out the Signal for a Message Event.
@StephenOTT I’ve successfully built the model and when while testing figured out that it’s missing one important condition: the process should wait for the final message AND all event sub tasks to complete before proceeding. Any idea how this condition can be implemented?
Process Starts, goes into a wait state at the Event Gateway.
Task Message is Received and an instance of the Event Sub-Process is activated
Task Message is Received and an instance of the Event Sub-Process is activated
Task Message is Received and an instance of the Event Sub-Process is activated
Final Message is Received and the Parent process goes to End Event.
The previous 3 Event Sub-Processes are still active and then complete.
All sub-processes are now complete, and so the parent was also complete as per step 5.
I cannot find the specific docs on this topic: But if the Parent reaches end, but the Sub-Process is still active, does the sub-process get terminated or is the sub-process(s) allowed to complete? Know where the docs are on this?
@StephenOTT
In your scenario sub-processes will complete and parent process will wait for them, however my model is a bit more complicated, after the final event comes in, there is a number of other steps in the process, which rely on data produced by sub-processes, therefore it’s essential to wait for the completion of all event sub-processes before proceeding. Actually you gave me a good idea - I want to try to place gateway and a final catch event into a sub-process and proceed to other steps only when this sub-process completes, including final message and all of message event sub-processes).
I solved it by placing everything between “Message Start Event” and “Wait for the definition of Aggregate job” gateway into a parent sub-process. The parent sub-process now awaits for all Event Sub-Processes and Final List to complete before proceeding to the next step.
@kpelykh I would even just take those extra steps and move them into a separate process which is called as a subprocess activated through the message end event. Would be a nice compartmentalization.