I try to get familiar with camunda and I would like to send a message from a sub process back to parent process so that the parent process continues. I have defined two processes. The parent process sends a message to the sub process which starts as soon as it receives the message. This works perfect. But the notification from the sub process back to the parent process doesn’t work.
The id of the parent process is available but the correlation throws an exception
Cannot correlate message ‘callbackMessage’: No process definition or execution matches the parameters
I read regarding this topic here and found that asynchronous might help. I enable it after the task “send message to sub process”, but without success.
Thanks for your reply…but this results in the same error. If I enable asynchrouns behaviour befor the task “send message to sub process”, the sub process will not start.
But I’m wondering if it only works with user tasks. If I replace the user tasks with service tasks and wait 1 second in the lower task, so that the upper process can continue to the gateway, the engine throws the “can not correlate message exception”. What am I doing wrong?
The order of when the process arrives at the receiving event/task and message delivery is important. Correlation only works when there is a process instance waiting for that specific message at the time of correlation. That’s why your initial solution (with and without async after “send message to sub process”) does not work. Regarding your second attempt, I guess by waiting for 1 second you mean Thread#sleep. This won’t help, as it only blocks the executing thread.
It should be fine when you add an asynchronous continuation in the subprocess, e.g. after the message start event. Then in the first transaction, the main process starts the subprocess until the asynchronous continuation is reached and then continues until the next wait state (here: event-based gateway). The second transaction delivers the callback message after that.
Correlation only works when there is a process instance waiting for that specific message at the time of correlation.
But what if the process has not arrived at the receive activity yet (catching event or receive task) but the sender has already sent the message? We can’t control the world, i.e. when the messages are sent.
Is it possible to somehow mark the process so that the engine knows that it should receive a certain mesage (and hence correlate the message to it)?