AnsweredAssumed Answered

ProcessInstance only returned after task ended

Question asked by kkdw on Jun 2, 2015
Latest reply on Jun 3, 2015 by kkdw
Hello,
I am trying to use Activiti as a sort of "pimped up" state machine -> the Process only contains ServiceTasks which point towards Java Delegates. In order to monitor the state of a running process I would like to access the processInstance Object after it is started. However when starting my process via

ProcessInstance procInst = runtime.startProcessInstanceByKey("myProcess");


procInst is only returned after the process ended. I activated the Async Executor via:
ProcessEngineConfiguration config = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
config.setAsyncExecutorEnabled(true);
config.setAsyncExecutorActivate(true);


And set the first service task in the Diagram to asynchronous, still no luck

My question is, if this is due to the process only containing Service Tasks (I read that startProcessInstanceByKey() is blocking and it will return only when process engine has nothing more to do (for instance, it reached user task which requires user interaction)), if so is there a workaround ?

Or should this actually work, i.e. I am doing something wrong?

Thanks in advance,
Konrad

Outcomes