Correlate Message Async Issue

I have an issue with the Correlate Message Async API (I’m using Camunda 7.18):

but I’m not sure if the issue is a miscomprehension on how this functionality works or whether it’s a bug.

  1. I have a workflow instance with variable ackId = 123 (but not containing a message reference called “A_MESSAGE” nowhere):

  2. I call POST /engine-rest/process-instance/message-async with:

{
  "messageName" : "A_MESSAGE",
  "processInstanceQuery": {
    "variables": [
        {"name": "ackId", "operator": "eq","value": "123" }
    ]
  }
}

Result of above call is that the job gets registered (HTTP 200 - I also get the job details returned in the response) (OK).

  1. Afterwards when I check in the Camunda UI the “Batch” screen … I see that the job is executed … but without errors! (NOK)

Shouldn’t the job execution of step 3. try to correlate on the given messageName AND ackId and put the job in a failed state if it can not do the correlation?

It seems as if messageName is completely ignored.

I also have a similar issue in case I adapt the BPM definition to add a Receive Event waiting for a messageName = A_MESSAGE but where that step is never reached.

Hello! Welcome to our community :smiley:

I believe that when you use “Correlate Message Async” passing a “processInstanceQuery” as a parameter, camunda does the correlate with the instance that corresponds to the query.

In your case, the query specifies a variable “ackId” with a value of “123”, so Camunda tries to correlate the message with the process instance that contains that variable and value.

If the instance is found and the correlate is done, then Camunda registers a job to execute the task… but if in case Camunda doesn’t find any instance or fails to make the correlate, it simply won’t register the job.

Hope I helped you!
Sorry for my bad english!

Regards.
William Robert Alves

Ok thanks for the quick reply :-).

My question was mainly related to the messageName parameter that can be passed which seems to be completely ignored. I would have thought that:

  1. The call POST /engine-rest/process-instance/message-async would at least check that the instance has a message defined with the given messageName

  2. The job created afterwards would then fail if for the given messageName + ackId the given message can’t be correlated to an event waiting for the given message.

maybe you can do something using conditionals or try / catch within your code to get the expected behavior.

Regards.
William Robert Alves