cancel
Showing results for 
Search instead for 
Did you mean: 

whats the best way to design a process that runs tasks async

gs76pl
Champ in-the-making
Champ in-the-making
hi,

i'm trying to design a process that would run each task/work in a separate thread but a process as a whole shouldn't progress until specific job has been completed.

          |———[async task A] —————————-
          |                                                    |
start—- +———[async task B]———-[async task C]—–+ —————-end

so for a design as above i'd like to start task A and B in a separate thread but task C shouldn't be started until task B has been completed.

This is very much like a user task where process engine waits for a task to be completed. Is there any other way of getting similar functionality as i don't want to mix user tasks with tasks that are not user specific. I tried to use receiveTask but there doesn't seem to be any place where i could put my code to invoke some job async.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Making a certain activity asynchronous is something we haven't implemented yet (it's also not part of the BPMN 2.0 spec).

On the forum, people have suggested that you can mimic asynchronicity by putting a 'fake' timer (with very small time) in front of the tasks you want to make async.

gs76pl
Champ in-the-making
Champ in-the-making
you're right about bpmn 2.0 and async tasks but on the other hand it provides "sendTask" and "receiveTask" to handle the same. While i've seen support for "receiveTask" in the Activiti documentation and junit tests, i couldn't find any mention of "sendTask", hence I assume it's not being supported yet. Are there any plans to add support for "sendTask"?

jbarrez
Star Contributor
Star Contributor
The send task does laready do something: sending a webservice call or sending an email - the webservice part being the  one of the BPMN spec.

However, what you need is more lightweight: a simple execution listener would already suffice uf you just want to send out a Java method call, and receive it in the recive task.