How to model prerequisites?

Hi everyone,

I have a problem with race conditions concerning message correlation. Let’s look at an example workflow:

After the Process started message is emitted, the messages Message 1 received and Message 2 received might occur after the Process started event is thrown.

This leads to the problem that the token might be at Task 1 when the Message 1 received event is emitted. This leads to a failing message correlation as the process instance is not waiting for the event.

What I would like to express:

  1. A prerequisite for Task 2 is the occurrence of the Message 1 received event and the completion of Task 1 (in no particular order).
  2. A prerequisite for Task 3 is the occurrence of the Message 2 received event and the completion of Task 2 (in no particular order).

I created the workflow which seems to solve this, but it feels very verbose:
[edit: look at my reply, I cannot put two images into one post as I am a forum newbie]

The workflow does not express my intention in a comprehensible way.

This (finally!) leads me to my question: Is there a better way to model this use case?

Thanks for your help!

Kind regards
Oliver

I thought about using CMMN which seems to fit quite well, but according to CMMN 1.1 Implementation Reference Camunda does not support Event listeners.

Does anyone have another idea or did I already find the best way?