ProcessInstance only returned after task ended
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2015 04:23 AM
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
procInst is only returned after the process ended. I activated the Async Executor via:
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
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
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2015 03:46 PM
No, when your service task is async, the method call returns before the service task is executed.
Note that the ProcessInstance object is a stale object, it wont be updated with the latest values, unless you refetch it.
Note that the ProcessInstance object is a stale object, it wont be updated with the latest values, unless you refetch it.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2015 04:02 PM
Hi!
Thanks a lot for your answer. I had indeed a bug in my code - now making the first service task asynchronous - will return the ProcessInstance object back.
Cheers,
Konrad
Thanks a lot for your answer. I had indeed a bug in my code - now making the first service task asynchronous - will return the ProcessInstance object back.
Cheers,
Konrad
