Problem with rest service - POST message

I want to send a message, first of all, the process fires two nested sub-process.
This is my task ouput

/engine-rest/task/

[
      {
      "id": "8ddeffc5-d51a-11eb-9777-0242ac160002",
      "name": "Generar Lista",
      "assignee": null,
      "created": "2021-06-24T15:32:39.100-0300",
      "due": null,
      "followUp": null,
      "delegationState": null,
      "description": null,
      "executionId": "8dded9b0-d51a-11eb-9777-0242ac160002",
      "owner": null,
      "parentTaskId": null,
      "priority": 50,
      "processDefinitionId": "priceEditorProcess:1:703bb8ba-d51a-11eb-9777-0242ac160002",
      "processInstanceId": "7c1b93e5-d51a-11eb-9777-0242ac160002",
      "taskDefinitionKey": "generateList",
      "caseExecutionId": null,
      "caseInstanceId": null,
      "caseDefinitionId": null,
      "suspended": false,
      "formKey": null,
      "tenantId": null
   },
      {
      "id": "8ddeffcb-d51a-11eb-9777-0242ac160002",
      "name": "Generar Lista",
      "assignee": null,
      "created": "2021-06-24T15:32:39.100-0300",
      "due": null,
      "followUp": null,
      "delegationState": null,
      "description": null,
      "executionId": "8ddeffc6-d51a-11eb-9777-0242ac160002",
      "owner": null,
      "parentTaskId": null,
      "priority": 50,
      "processDefinitionId": "priceEditorProcess:1:703bb8ba-d51a-11eb-9777-0242ac160002",
      "processInstanceId": "7c1b93e5-d51a-11eb-9777-0242ac160002",
      "taskDefinitionKey": "generateList",
      "caseExecutionId": null,
      "caseInstanceId": null,
      "caseDefinitionId": null,
      "suspended": false,
      "formKey": null,
      "tenantId": null
   }
]

Now i want to a send a message to a specific process,

/engine-rest/message

{
 "messageName" : "cancelPriceEditMessage",
 "businessKey" : "1987819024",
  "processInstanceId": "7c1b93e5-d51a-11eb-9777-0242ac160002"
}

And this is my error

{
   "type": "RestException",
   "message": "org.camunda.bpm.engine.MismatchingMessageCorrelationException: ENGINE-13031 Cannot correlate a message with name 'cancelPriceEditMessage' to a single execution. 2 executions match the correlation keys: CorrelationSet [businessKey=1987819024, processInstanceId=7c1b93e5-d51a-11eb-9777-0242ac160002, processDefinitionId=null, correlationKeys=null, localCorrelationKeys=null, tenantId=null, isTenantIdSet=false]"
}

How do i send the specific processDefinitionId in the POST message? I tried y many ways but all had failed

Hi @gabylan12
Welcome to the forum.

The problem you’re having is likely that you have 2 instances in the same process waiting for the same message.
In BPMN the message event has a specific rule that ensures that for given correlation that only one message matches it. So thats why it wouldn’t trigger the message.

Hello @Niall and @gabylan12 ,

as I see it, the process instance is provided as well as the business key. But it was described that two executions wait for the same message here, and that is the problem. The only way to refer a specific execution is using the parameter “localCorrelationKeys” as described here:

https://docs.camunda.org/manual/latest/reference/rest/message/post-message/

Workaround would be to use a call activity in multi instance. By this, each message correlation had its own process instance.

Hope this helps

Jonathan