Camunda.Api.Client icon indicating copy to clipboard operation
Camunda.Api.Client copied to clipboard

CorrelationMessage BusinessKey default value

Open Sashiri opened this issue 4 years ago • 0 comments

Hi, the code snippet below won't work cause BusinessKey default value is set to "". Camunda will try to look for processInstanceId with BusinessKey == "" and that will most likely fail

var camundaClient = CreateCamundaClient();
var processInstanceId = await GetProcessInstanceIdByUniqueVariable("uniqueVariable", uniqueVariableValue);
var message = new CorrelationMessage() { ProcessInstanceId = processInstanceId, MessageName = "messageName"};
await camundaClient.Messages.DeliverMessage(message);

Maybe you should consider deleting default value Sending this JSON directly to camunda rest engine will succeed, executing (in my case interrupting) message in given process instance

{
  "messageName": "messageName",
  "processInstanceId": "processInstanceId"
}

Ofc. following will also work

{
  "messageName": "messageName",
  "processInstanceId": "processInstanceId",
  "businessKey": null
}

Setting BusinessKey to null in constructor will also work, but doing that is not obvious.

var camundaClient = CreateCamundaClient();
var processInstanceId = await GetProcessInstanceIdByUniqueVariable("uniqueVariable", uniqueVariableValue);
var message = new CorrelationMessage() { 
  ProcessInstanceId = processInstanceId, 
  MessageName = "messageName", 
  BuisnessKey = null
};
await camundaClient.Messages.DeliverMessage(message);

Sashiri avatar Jan 21 '21 14:01 Sashiri