Hi everyone,
I’m getting a problem while trying to kill a process.
Here is the diagram:
Basically, I need to be able to kill the process in several steps.
The mechanism is the following:
for aborting a process I trigger either take-in-charge cancellation event or edit-draft cancellation event or close-hr cancellation event or add-logistic cancellation event.
In the ExecutionListener attached to the BoundaryCatchEvent I correlate the abort process event.
Here is the code:
public class CamundaMessageHandler implements ExecutionListener {
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
Long mutationId = (Long) delegateExecution.getVariable(HRMutationProcessDefinitions.ProcessVariables.MUTATION_ID);
delegateExecution.getProcessEngineServices().getRuntimeService().createMessageCorrelation(HRMutationProcessDefinitions.Activities.ABORT_MUTATION_CANCELLING_MESSAGE)
.processInstanceVariableEquals(HRMutationProcessDefinitions.ProcessVariables.MUTATION_ID, mutationId).correlate();
while there is no logic in the ExecutionListener attached to the start event of the EventSubProcess (I just attach it for receiving the event).
It works somehow because the “Revert new mutation data” successfully modify my DB and the '‘Undo new Mutation message’ properly send the e-mail it is supposed to send.
The problem is that the terminate end event doesn’t kill the process but throws an exception instead.
(I’m sorry but I can’t put the whole stacktrace)
16:30:34,729 SEVERE [org.camunda.bpm.engine.impl.interceptor.CommandContext] (http-/127.0.0.1:8080-3) Error while closing command context: java.lang.NullPointerException
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.getFlowScopeExecution(PvmExecutionImpl.java:1152) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.createActivityExecutionMapping(PvmExecutionImpl.java:1142) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior$ErrorDeclarationFinder.collect(AbstractBpmnActivityBehavior.java:248) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior$ErrorDeclarationFinder.collect(AbstractBpmnActivityBehavior.java:223) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.tree.TreeWalker.walkUntil(TreeWalker.java:72) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.propagateError(AbstractBpmnActivityBehavior.java:124) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.propagateExceptionAsError(AbstractBpmnActivityBehavior.java:94) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior.execute(ServiceTaskDelegateExpressionActivityBehavior.java:137) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:42) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:27) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:484) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:464) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:56) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:26) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:134) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:494) [camunda-engine-7.3.0.jar:7.3.0]
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:473) [camunda-engine-7.3.0.jar:7.3.0]
I think the problem is after the send task because if the problem were there I guess I should get a ProcessEngineException instead and so not send any recover e-mail.
So, according to this
I should be outside the transaction border of '‘Undo new Mutation message’ send task.
Which makes me think about the terminate end event but I don’t see what the problem could be.
And the processInstance stays of course in the previous stable state which is the userTask receiving the cancellation message (no matter which one).
Any help/idea???
thanks in advance,
Cheers,
Paolo