-
1. Re: Start jBPM process via rest API asynchronously
salaboy21 Jul 30, 2014 6:29 AM (in response to lauradp)1 of 1 people found this helpfulOne way to solve it for now could be to add the first task in your process async, that will cause that the start process and the scheduling of the first task will be done sync but as soon as the first task is scheduled your client will gain control again.
We are planning to expose the executor API via rest so you can just call the StartProcessCommand which will be executed asynchronously by the executor component in future version.
Regards
-
2. Re: Start jBPM process via rest API asynchronously
lauradp Jul 30, 2014 6:42 AM (in response to salaboy21)Thanks for your answer, Mauricio!
What do you mean with "add the first task in your process async,"? Should I add a task named asynch or simply a task whose handler doesn't call workItem.complete() method?
Laura
-
3. Re: Start jBPM process via rest API asynchronously
lauradp Jul 30, 2014 4:51 PM (in response to lauradp)Hi,
I tansformed my first tasks (thah only write a log message) into an asynchronous one:
public class AsyncLogTaskHandler extends SaakAkTaskHandlerAbstract {
private static Logger trace = Logger.getLogger(AsyncLogTaskHandler.class);
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
final long pid = workItem.getProcessInstanceId();
final long wiId = workItem.getId();
trace.info("Running AsyncLogTaskHandler for work item " + wiId + " for process " + pid);
new AsyncLogTaskExecutor(workItem, manager).run();
}
}
with AsyncLogTaskExecutor thad does stuffs and completes the workItem, but my rest client doesn't gain control until the last task of my process completes.
Mauricio said that "first task will be done sync but as soon as the first task is scheduled your client will gain control again.", did I miss something?
Laura
-
4. Re: Start jBPM process via rest API asynchronously
swiderski.maciej Aug 4, 2014 3:27 AM (in response to lauradp)1 of 1 people found this helpfulsimplest way would be to use jbpm executor and its async work item handler to perform task in back ground and by that release current thread
HTH