Cannot correlate message 'Message2': No process definition or execution matches the parameters

Hi everyone,
I have a process in which I want to send a message from a send task (task_5) to a receive task (task_3):

I have set the Global Message Name in task_3 as Message2. And in Java Class related to task_5, I have written the following code:

public void execute(DelegateExecution delegateExecution) throws Exception {
        delegateExecution.getProcessEngineServices().getRuntimeService()
                .createMessageCorrelation("Message2")
                .correlate();
}

But I receive the following error, when the execute method runs:

 Cannot correlate message 'Message2': No process definition or execution matches the parameters

I had done a very similar thing for sending the message from task_2 to start_2 and had no problem. I also saw this post which had a similar problem. Considering that, I marked task_5 with async-before. But I encountered the same error.

Could anyone please help me to find out the problem?
Thanks in advance

Hi,

Please check the configuration of your process. Especially check

  1. The spelling of the messages
  2. That async-before is set for Task 5
  3. That Pool_2 is set as executable

I tried to reproduce your issue. Therefore, I created the following BPMN:
example_processes.bpmn (7.8 KB)
It reached Task_4 without any issues.

3 Likes

Hi @StephanHaarmann ,
Thanks a lot for your quick reply.
I had tested using async-before on task 5 and it didn’t work. But now, I tried it again and it seems working fine! Sorry, I don’t know what was the problem last time.
But I still don’t get why this async-before is needed. I saw the explanations in this forum post, but I didn’t get it very well. I guess the token in Pool_1 should arrive Task_3 before the token in Pool_2 arrives task_5. Then, there should be no problem in correlation.

I do appreciate it if you could explain it a bit, I am new in this correlation concept.

I’ll give it a try.

If not otherwise specified, Camunda 7 uses waiting states as transaction boundaries. These waiting states exist everywhere, where the engine has to wait for something. Examples are user tasks and most catching events.

With this behavior, Camunda 7 does as much work as possible in one transaction. This improves throughput, but is not always enough. Your process is an example for the limitation:

By default, the first transaction spans from Start to Task_1 the second transaction from Task_1 via Task_2, Start 2, and Task_5 to the end event of Pool_2. The job executor only enables Task_3 after Pool_2 completed. This is impossible because task_5 requires that task_3 is enabled. We have a cyclic dependency.

In other words, Camunda 7 processes tasks in the order that they occur: When Task_2 is executed and Message1 is sent, the transaction continues with Pool_2. Task_2 is active until Pool_2 reaches a transaction boundary. By setting async before we manually add such a transaction boundary. Once Pool_2 reaches the transaction boundary, Camunda knows that Message1 was successfully processed and Task_2 completes. Task_3 is reached (wait state) and the transaction committed.

Camunda’s transaction handling is not trivial and requires some experience. You can read more about it in our documentation:

Furthermore, I recommend following our best practices for setting transaction boundaries:

Finally, there exists a modeler plugin that visualizes transaction boundaries:

I hope this helps.

3 Likes

Hi @StephanHaarmann,
Many thanks for your comprehensive explanation, and for the links. Now, it became clear for me why async-before is required.

2 Likes