AnsweredAssumed Answered

Skipping an async ServiceTask with the ManagementService

Question asked by damokles on Jul 7, 2014
Latest reply on Jul 9, 2014 by jbarrez
In our JavaServiceTask we are calling an external REST-Service that is unfortunately not idempotent. Due to an exception the Activiti execution was rolled back after the service call was made. In the subsequent retries the REST call fails since it already knows the transaction id. We need a way to skip the actual service task execution and move to the next step, which in our case is a complex event gateway with three messages.

Using the ManagementService we have wrote this command, that almost does what we want. The problem is that it does not delete the async job for the current task, and that it somehow creates a new ProcessInstanceId, while keeping the ExecutionId the same, I would have expected the opposite behavior.

Any tipps what we are missing here?

public class PerformOutgoingBehavior implements Command<Boolean>, Serializable {

    private final Execution execution;

    public PerformOutgoingBehavior(@Nonnull Execution execution) {
        this.execution = execution;

    public Boolean execute(CommandContext commandContext) {
        ExecutionEntityManager executionManager = commandContext.getExecutionEntityManager();
        ExecutionEntity executionEntity = executionManager.findExecutionById(execution.getId());

        new BpmnActivityBehavior().performDefaultOutgoingBehavior(executionEntity)
        return true;