Camunda - 中间消息事件无法与单次执行相关联

Camunda - Intermedia message event cannot correlate to a single execution

我创建了一个小应用程序(Spring Boot 和 camunda)来处理订单流程。 Order-Service 通过 Rest 接收新订单并调用 BPMN Order 工作流的 Start Event。订单流程包含两个异步 JMS 调用(客户检查和仓库库存检查)。如果两者都检查 return,则订购过程应该继续。

Start 事件在 Spring Rest 控制器中被调用:

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

发送任务(例如客户检查)将 JMS 消息发送到异步队列中。 此服务的应答被另一个 Spring 组件捕获,该组件然后尝试发送中间消息:

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

我停用了仓库服务以查看订单进程是否等待第二次调用的到来,但我却得到了这个异常:

  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]

这是我的流程。我看不到 post 我的 bpmn 文件的方法:-(

有什么不能与消息名称和业务密钥关联? JMS 队列为空,有其他具有相同 businessKey 的消息在等待。

谢谢!

只是为了缩小问题的范围:在尝试关联之前执行 runtimeService eventSubscription 查询并检查实际上正在等待的订阅..也许您有重复的消息名称?也许您(不小心)拥有同一进程的另一个实例 运行?确定订阅后,您可以直接通知执行,而无需使用关联构建器 ...