我有一个看起来像这样的 Camunda 流程:
我使用 Exclusive Gateway 在我的工作流程中创建一个分支:当电子邮件已被确认时,我会继续,如果没有,我想确认它。
为了实现这一点,我在我的序列流中添加了以下条件:
<!-- GATEWAY -->
<bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="GO_TO_CONFIRM_EMAIL">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:outgoing>GO_TO_CONFIRM_EMAIL</bpmn2:outgoing>
<bpmn2:outgoing>GO_TO_IDENTIFY_ORDER</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<!-- DEFAULT FLOW -->
<bpmn2:sequenceFlow id="GO_TO_CONFIRM_EMAIL" name="!confirmed" sourceRef="ExclusiveGateway_1" targetRef="CONFIRM_EMAIL"/>
<!-- FLOW WITH CONDITION -->
<bpmn2:sequenceFlow id="GO_TO_IDENTIFY_ORDER" name="confirmed" sourceRef="ExclusiveGateway_1" targetRef="IDENTIFY_ORDER">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">${confirmEmailTaskAdapter.isConfirmed(CONFIRMED_ORDER_JSON)}</bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
但是,当我运行它时,我得到以下异常:
org.camunda.bpm.engine.ProcessEngineException: Cannot construct activity-execution mapping: there are more scope executions missing than explained by the flow scope hierarchy.
at org.camunda.bpm.engine.impl.pvm.runtime.LegacyBehavior.createActivityExecutionMapping(LegacyBehavior.java:294)
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.createActivityExecutionMapping(PvmExecutionImpl.java:1211)
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.createActivityExecutionMapping(PvmExecutionImpl.java:1144)
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior$ErrorDeclarationFinder.collect(AbstractBpmnActivityBehavior.java:248)
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior$ErrorDeclarationFinder.collect(AbstractBpmnActivityBehavior.java:223)
at org.camunda.bpm.engine.impl.tree.TreeWalker.walkUntil(TreeWalker.java:72)
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.propagateError(AbstractBpmnActivityBehavior.java:124)
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.propagateExceptionAsError(AbstractBpmnActivityBehavior.java:94)
at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior.execute(ServiceTaskExpressionActivityBehavior.java:64)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:42)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:27)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:484)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:464)
... and some more ...
但是,如果我将条件更改为非常简单的条件,则该过程有效:
<!-- THIS WORKS FINE -->
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">${true}</bpmn2:conditionExpression>
我的 Spring Bean 看起来很正常:
@Component
public class ConfirmEmailTaskAdapter {
public boolean isConfirmed(String json) {
// bla bla bla
return true;
}
}
为什么在 Camunda 条件下不使用我的 Spring Bean 不起作用?