Cannot correlate message


I have a test process I’m playing with and I’m stuck with message correlation.

reg_test.bpmn (30.9 KB)

In an attached diagram I have a Java delegate in “Register” service task, which successfully starts another process with message event. I’m doing it like this:

.startProcessInstanceByMessage(“RegisterRequestReceivedMessage”, …);

But when I try to continue parent process with another message, I’m getting this “Cannot correlate message … : No process definition or execution matches the parameters” error.

I’ve tried a few techniques that were suggested in similar threads on this forum, but still no luck.

My last guess was that maybe I’m too fast at some points of execution, but additional timer event didn’t solved the problem.

I have this code in “Send Email/Sms” service tasks delegates:


There’s no error with this, but the parent process didn’t proceeded with execution (it hangs on waiting for the messages). If I call API method though (http://localhost:8080/engine-rest/message), the process gets the message it waits for and continues, but it works only if do it manually (I guess there’s some problem with timing). If I do it with http connector from inside “intermediate throw event” (I know it’s not the way it designed to be used, but it was just a test) it also doesn’t works.

So, how do I properly notify parent process with message events and what is wrong with my process?

Thanks in advance.

P.s.: I’m running it in the latest camunda-jboss docker.


I suspect you have a race condition in that the receive intermediate event is not yet created before your child process tries to correlate. Think about the thread of control. It starts in the parent process where there is the register task. Hence this starts the child process. At this point, the parent process does not continue as the thread of control is executing in the child process. This will continue through to the send tasks of the child. Hence the child will try to correlate back to the parent whilst the parent is still executing the register task and thus there is nothing to correlate to…

You could add some asynch continuations at appropriate points, this will reduce the incidence of the race condition, however it will not completely remove it…



1 Like


Thank you very much for your answer.

I thought startProcessInstanceByMessage() starts a new thread for a new process and continues it’s execution afterwards.

Marking 2nd process start point with “Asynchronous before” flag solved the problem. Although I understand the race condition not completely disappeared, now I can handle it.

Thanks once again.



Could you please share your updated bpmn file. And did you use startProcessInstanceByMessage method or createMessageCorrelation method?