bpmn - Camunda - 中间消息事件不能与单个执行相关联
问题描述
我创建了一个小型应用程序(Spring Boot 和 camunda)来处理订单流程。Order-Service 通过 Rest 接收新订单并调用 BPMN Order 工作流的 Start Event。订单流程包含两个异步 JMS 调用(客户检查和仓库库存检查)。如果两项检查均返回,则订单流程应继续。
在 Spring Rest Controller 中调用 Start 事件:
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]
什么不能与消息名称和业务密钥不相关?JMS 队列为空,还有其他具有相同业务密钥的消息在等待。
谢谢!
解决方案
只是为了缩小问题范围:在您尝试关联并检查哪些订阅实际上在等待之前执行 runtimeService eventSubscription 查询。也许您有重复的消息名称?也许您(意外地)运行了同一进程的另一个实例?确定订阅后,您可以直接通知执行,而无需使用关联构建器...
推荐阅读
- sitefinity - 在 Sitefinity 上安装 UCommerce 并引发 NewtonSoft.json 错误
- identity - EFCore 身份:管理员剃刀页面:创建具有角色的用户
- c++ - 估计内存映射 boost rtree 所需的大小
- git - 是否可以在 Mac 上使用 GitJournal?
- redis - 在 RediSearch 中搜索多个索引
- r - R:如何删除语料库中特定单词以外的单词
- javascript - 从给定的身份证号码获取出生日期
- opengl - 如何更新纹理的某个通道
- c++ - 多重继承的模板化类歧义问题的继承
- html - 在“仅媒体屏幕和(最大宽度:430px)”事物中时,flex 容器内的 Div 不会缩小