Intermediate Catch Event asynchronous behavior

Hello, I have the following case and can’t really understand what is the problem.

image

Create order task has async continuation Before and Exclusive.
Update order task has async continuation Before and Exclusive.

For the catch event, I want to have both before and after async, but if I also make it exclusive, I can’t correlate a message to it. I just get MismatchingMessageCorrelationException even if the process is for sure waiting for the event.

This happens in a Junit 5 test. If I remove the exclusive flag from the event, everything works fine, but if it is there, message correlation does not work.

What is really happening here? Is this a problem with the test library or my transaction handling is wrong?

Hi @evstatiev,

the message catch event is a wait state and it doesn’t need an additional async continuation: Transactions in Processes | docs.camunda.org

In a JUnit test, with the job executor disabled, you can use execute(job()) to hop over the async continuation boundary: Assert Examples | docs.camunda.org

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,

thank you for the fast reply. I got confused by this documentation Understanding Camunda 7 transaction handling | Camunda 8 Docs which states that Async After is a good idea for receive tasks.

Regarding the test, I also tried with execute job for the intermediate catch event, but it does not get completed.

Hi @evstatiev,

This could be async before on the next task as well. Technically, there is no difference (except you have some execution listeners on the sequence flow). When you do async after and async before on two consecutive tasks, it is (mostly) a waste of resources, as you need execute(job()) two times.

The process test coverage is a good tool to find out how your process instance progressed in the test.

Hope this helps, Ingo

1 Like

With the information about wait states and async before on the next task is the same as async after on the current, I will just remove all explicit async handling on the catch event.

This way the test works fine.

Thank you and have a nice day!

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