Schedule Camunda Parallel Sub-Processes independently

I’m building a Business Flow for a Task that goes through lots of Review Task between multiple people, until it gets Decided then it needs to go into a decisioned Flow.

Try to achieve that on Camunda 7.19 as below…

First A decision Table and a Service Task decides a list of the next Tasks needs to be scheduled (into a list).

Then Perform Next Task is a multi-instance sub-process that schedule those list of Tasks as below

Finally once one of those Review-Tasks decides the case, the case should go back up to the parent process & continue on to Decisioned Case Sub-Process.

The Problem… I need the ability to schedule multiple Review Tasks at the same time, however I’m not always able to return to the part & hit that case decided Gateway because only one of the two tasks scheduled are completed, the other is still scheduled.

Current Behavior

Review Task A (completed [B & C should be next])
   |_ Review Task B (Scheduled)
   |_ Review Task C (Scheduled)

Review Task C (Completes [D should be Next, along with whatever from before])
   |_ Only Review Task B (Scheduled)

Review Task B (Completed [Y should be Next, along with whatever from before])
   |_ Only Task Y (Scheduled)

Review Task Y (Completed with case Decisioned)
   |_ Decisioned Case sub-process Starts

Desired Behavior

Review Task A (completed [B & C should be next])
   |_ Review Task B (Scheduled)
   |_ Review Task C (Scheduled)

Review Task C (Completes [D should be Next, along with whatever from before])
   |_ Review Task B (Scheduled)
   |_ Review Task D (Scheduled)

Review Task B (Completed [Y should be Next, along with whatever from before])
   |_ Review Task D (Scheduled)
   |_ Review Task Y (Scheduled)

Review Task Y (Completed with case Decisioned)
   |_ Review Task D (Canceled)
   |_ Decisioned Case sub-process Starts

The Fact that I’m running two sub-processes & then finishing one and wants it to go back up to the parent and continue the flow, while the other one needs to still be there & continue whenever the human task is completed… is what I can’t seem to achieve.

Any Help or pointers would be much appreciated… sorry for the long post

Hi @Saher

I believe that using an interrupting boundary message event should serve your needs.

Hi Saher,

If I have understood your requirement correctly, the below solution might work.
With the help of non-interrupting message boundary event, you can capture the message and go back to the parent while one of the multi instance sub-process(Review Task) is in progress and trigger the next review task. You can repeat the same until you achieve completing all your review tasks.

Hope this helps.

If I understand you requirement correctly, I think there is one small point missing from the previous solution. I understood that all open tasks should be cancelled if a reviewer decides the case and no further reviews are needed.
That could be done by changing the scope to a transactional scope and using the cancel end event.
What I don’t completely like about this model is, that the “normal” flow would be the one, where all tasks are reviewed, no further tasks exist and still no decision was reached.
But currently I cannot think of a better way to model this scenario.

1 Like

Thank you for the answers, I will try both suggestions & will update soon

thank you all for the replies, I will implement & try the above suggestions and will update the group soon… appreciate the help

1 Like

I apologize for the long time, but I don’t seem to be able to connect the End Event Message with the non-interrupting message boundary event.

below is my Message End Event along with the message correlation implementation

String caseInstanceId = delegateExecution.getProcessInstanceId();
String TaskCompletedMessage = "TaskCompleted";

MessageCorrelationBuilder correlation = delegateExecution.getProcessEngineServices().getRuntimeService().createMessageCorrelation(TaskCompletedMessage);
correlation.setVariable("caseInstanceId", caseInstanceId).correlateAll();

issue is, the message boundary event doesn’t seem to ever pick the message up… it always continue to the process after the boundary.

any suggestions?

Your correlation doesn’t seem to be right.
If your correlating on the process instance id, use the following

correlationBuilder.processInstanceId(caseInstanceId).correlateAll()

Otherwise you are setting a variable, but not correlating on the variable.

I think I’m missing something else, this is my current flow (I’ve tried a transactional sub-process & and the regular one)

trying correlation.processInstanceId(caseInstanceId).correlateWithResult(); is giving a MismatchingMessageCorrelationException No process definition or execution matches the parameters

trying correlation.correlateAllWithResult(); is giving a null result

once again, appreciate your help very much!

Hi @Saher,

Could you please share your bpmn file…

bpmn file I’m currently using for both the main flow & process task flow (the sub-process)
process_perform_task.bpmn (10.1 KB)
process_main_flow.bpmn (11.1 KB)

Hello my friend @Saher!

I believe that because your “send message” is a “FINAL” event, at the same time that it makes the call to your message boundary event, your instance has already left the subprocess, and that is why you are receiving this mismatching.

The mismatchingCorrelationException happens when Camunda does not find any instance in the scope to receive that correlated message… or when the correlation message does not exist / has not been configured.

I believe that if you put a message intermediate throw event and then an end event, your instance will not have gone out of scope by the time the correlate is fired, and it will work fine!

Example:

I apologize for the delay in responding, I took 5 days of vacation to rest a little, and I was partially offline during this period.

I hope this helps!

William Robert Alves

Quick reminder…
Message events must cross a process boundary, so sending messages from a subprocess to its parent is not allowed in the BPMN spec.

In this case it makes more sense to use the escalation event.

William Robert Alves

Interesting point @GotnOGuts I wasn’t aware of that & thanks @WilliamR.Alves for the suggestion I will try to implement & will update here in a day or so.

thank you so much for your efforts, much appretiated.

1 Like

Thanks to everyone who helped with suggestions on this question, I was finally able to get the process modeled as I wanted to using the escalation events inside a parallel sub-process as suggested by @WilliamR.Alves & @rohwerj

In case someone in the future needs the full process to take a look…


process_case.bpmn (18.4 KB)

2 Likes

That’s great brother! \o/
I’m happy to be able to help!

William Robert Alves

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.