Token flow around asynchronous service tasks

207 views
Skip to first unread message

roleba...@gmail.com

unread,
Jan 21, 2016, 7:13:16 AM1/21/16
to camunda BPM users
Does the token automatically move forward to the next activity at the moment the process execution arrives at a asnycronous service task such as calling a asynchronous method in java?

thorben....@camunda.com

unread,
Jan 21, 2016, 11:00:06 AM1/21/16
to camunda BPM users, roleba...@gmail.com
Hi,

No, this is not the same concept. It always holds in the BPMN engine that a token only moves past a task if its payload (e.g. a JavaDelegate in case of a service task) was executed completely.

The phrase "asynchronous continuation" can lead to misunderstandings when you are familiar with asynchronous invocations of code in a programming language. In the process engine, it does not mean asynchronous invocation of the service but rather that process flow continues asynchronously, i.e. that the token continues past the point of the continuation not as part of the current API invocation.

I hope that makes sense.

Cheers,
Thorben

roleba...@gmail.com

unread,
Jan 21, 2016, 12:24:24 PM1/21/16
to camunda BPM users, roleba...@gmail.com
Ok, that is interesting. So the process flow for synchronous service tasks is exactly the same as for asynchronous service tasks when they are created as exclusive jobs (except the differences for the transaction boundaries)?

roleba...@gmail.com

unread,
Jan 21, 2016, 12:32:55 PM1/21/16
to camunda BPM users, roleba...@gmail.com
I've found a good picture from the blog http://3.bp.blogspot.com/-QY6TZDqztWE/Un_Yf13y3QI/AAAAAAAAAP4/NhcVK0lnY_4/s1600/async-service-invocation.png

It shows that the callback is asynchronous and explains the callback as follows: "Finally it sends a callback to the process engine which may now continue execution in the process instance."

thorben....@camunda.com

unread,
Jan 21, 2016, 12:37:23 PM1/21/16
to camunda BPM users, roleba...@gmail.com
Hi,

We might have a misunderstanding here. I assumed you are referring to asynchronous continuations (when you declare the camunda:asyncBefore or camunda:asyncAfter attribute on a task). The blog post you mention [1] deals with the asynchronous service task pattern. These are two different things. If you refer to the latter, then yes, your initial understanding is correct, the token moves on.

Cheers,
Thorben

[1] http://blog.camunda.org/post/2013/11/bpmn-service-synchronous-asynchronous/

roleba...@gmail.com

unread,
Jan 21, 2016, 1:11:50 PM1/21/16
to camunda BPM users, roleba...@gmail.com
Good catch! I wasn't aware about the asynchronous invocation concept before. Another very interesting concept :-)

As far as I understood the concept of "asynchronous continuation" the token does not move on before the service task job has been completed. Is that correct?

Regarding the "asynchronous invocation" concept: Is it still an advanced pattern of the process engine based on internal (non-public) API as stated in https://github.com/camunda/camunda-bpm-examples/tree/master/servicetask/service-invocation-asynchronous#asynchronous-service-invocation?

thorben....@camunda.com

unread,
Jan 22, 2016, 4:14:01 AM1/22/16
to camunda BPM users, roleba...@gmail.com
Yes to both questions :)
Reply all
Reply to author
Forward
0 new messages