AnsweredAssumed Answered

Issue with starting process instance Async

Question asked by kapil00 on Oct 9, 2014
Latest reply on Oct 10, 2014 by martin.grofcik
We are trying to split the process instance start that happens with RuntimeService.startProcessInstanceById(id) into two(create and start) to achieve starting process instance Async so that we can get the processInstanceId back without having to wait for process to run.

So we split the org.activiti.engine.impl.cmd.StartProcessInstanceCmd into two of our own commands CreateProcessInstanceCmd and RunProcessInstanceCmd.


DeploymentManager deploymentCache = Context.getProcessEngineConfiguration().getDeploymentManager();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
ExecutionEntity processInstance = processDefinition.createProcessInstance();


ExecutionEntity processInstance = Context.getCommandContext().getExecutionEntityManager().findExecutionById(processInstanceId);

Everything seem to work fine, other then two issues we noticed that might be related:

1. Workflow completes but Start event remains unfinished and END_TIME and DURATION in ACT_HI_ACTINST table does not get populated.
2. If the first service task after Start was marked as "activiti:async="true" the workflow does not start and stays at start event.

Any help will be appreciated.