Intermedia message event cannot correlate to a single execution

I created a small application (Spring Boot and camunda) to process an order process. The Order-Service receives the new order via Rest and calls the Start Event of the BPMN Order workflow. The order process contains two asynchronous JMS calls (Customer check and Warehouse Stock check). If both checks return the order process should continue.

(see the attached bpmn-file)
orderService.bpmn (9.2 KB)

The Start event is called within a Spring Rest Controller:

    ProcessInstance processInstance =
            runtimeService.startProcessInstanceByKey("orderService", String.valueOf(order.getId()));

The Send Task (e.g. the customer check) sends the JMS message into a asynchronous queue.
The answer of this service is catched by a another Spring component which then trys to send an intermediate message:

runtimeService.createMessageCorrelation(“msgReceiveCheckCustomerCredibility”)
.processInstanceBusinessKey(response.getOrder().getBpmnBusinessKey())
.setVariable(“resultOrderCheckCustomterCredibility”, response)
.correlate();

I deactivated the warehouse service to see if the order process waits for the arrival of the second call, but instead I get this exception:

1115 06:33:08.564 WARN [o.c.b.e.jobexecutor] ENGINE-14006 Exception while executing job 67d2cc24-0769-11ea-933a-d89ef3425300:
org.springframework.messaging.MessageHandlingException: nested exception is org.camunda.bpm.engine.MismatchingMessageCorrelationException: ENGINE-13031 Cannot correlate a message with name ‘msgReceiveCheckCustomerCredibility’ to a single execution. 4 executions match the correlation keys: CorrelationSet [businessKey=1, processInstanceId=null, processDefinitionId=null, correlationKeys=null, localCorrelationKeys=null, tenantId=null, isTenantIdSet=false]

This is my process:

What can’t it not correlate with the message name and the business key? The JMS queues are empty, there are other messages with the same businessKey waiting.

Thanks!

Hi @Ottington,

is your business key unique? Form the error message, I assume that you have 4 process instances waiting for the message. And all have business key 1.

Hope this helps, Ingo