What's the difference of Asynchronous before and after?

Hello all,

I would like to pose two questions related to Asynchronous Continuations.


  1. What’s its usage and when should I use it?
  2. What’s the difference of asynchronous before and asynchronous after?

Thank you in advance.



Hi @nikolaosnousias,

have you had a look in the docs: https://docs.camunda.org/manual/7.14/user-guide/process-engine/transactions-in-processes/#asynchronous-continuations?

Hope this helps, Ingo

1 Like

@nikolaosnousias Additionally you can refer this too.

@Ingo_Richtsmeier @aravindhrs Hello both,
thanks for your answers.

I just read the docs that you suggested me to have a look. However, I m still missing the real point of using asynchronous continuations. In docs, it is stated that “Asynchronous continuations are break-points in the process execution. They are used as transaction boundaries and allow another thread than the currently active thread to continue execution.”

I do not understand how the transaction boundaries are defined.

Could you please try to clarify why should I do use an asynchronous continuation for example for a service task? If you could give me an example from your perspective, I would appreciate it, since I don’t get the point in docs.

For example I have the following simple process.

If there is an error during the Service Task “Make matching” (implemented by a JavaClass), an error is thrown to the engine using the code:

throw new BpmnError("wrongCode");

I have specified the Error Name and the Error Code of the boundary error event as “wrongCode”.

1st case:If I do not specify an asynchronous continuation and I start the process with Postman, I do not catch this error on cockpit and I receive a message on Postman (“500 Internal Server Error”).

2nd case: If I throw an error from my java code and I catch it with a bpmn error symbol, I can see and handle the error in my process.

3rd case: On the other hand, if I specify a before asynchronous continuation on my service task (without throwing a bpmn error from java code), I can see the incident on cockpit.

So, what exactly does the asynchronous continuation in this example? The only difference with throwing an error from java code, is that a new incident is created? why someone would choose asynchronous continuation to catch an error while it can be done with bpmn error symbol?

Thank you in advance for your time and your willingness to help me.

Hi @nikolaosnousias,

the important facts from the chapter:

The process engine is a piece of passive Java code which works in the Thread of the client.

If an exception occurs when calling startProcessInstanceByKey the process instance will not be saved to the database at all.

Service tasks implemented by a JavaDelegate or expression are called in this thread, and if the call fails, the exception will roll back the current process execution and show the exception to the caller (case 1).

Savepoints configure the process execution to save the state from the main memory to the database. This will decrease the amount of rolled back service tasks. If you don’t catch the error, it will be shown in the cockpit as an incident (case 3).

Additionally, if you are able to handle this error in the process with other tasks, you can wrap your execption into a BpmnError and and catch this with an error event.

If you don’t fill the details of the error event, it will handle all execptions (case 2).

Have a look at this topic about error events: Error Events | docs.camunda.org

Hope this helps, Ingo


@Ingo_Richtsmeier Thank you so so much Ingo for your time and your willingness to help me.

1 Like