Camunda rest API; callbacks or notifications on completion

we are integrating camunda into a client-server deployment, where the client calls the camunda rest api to start a process and then gets variables from the results from the process instance. I was looking around in the documentation and the forum - there were some explanations on how to call processes from inside camunda, but couldn’t find anything on how to do this specifically. To be more precise, what I would want is to be notified once a process instance has finished (say a callback or a - possibly - push notification from inside camunda), so we can fetch the process instance variables.

The options that I’ve found so far:

  1. check regularly from the client:
    i) /process-definition/{id}/submit-form
    ii) process-instance/{processId}/variables/{variableName}
    If not completed do ii) again (in polling intervals) until waited too long or tried too often.

  2. implement a callback from inside the camunda process:
    (There’s a very rough pattern lined out at, but I don’t think it applies to my use case.)

It could use something like an ExecutionListener:
public class NotificationExecutionListener implements ExecutionListener {
public void notify(DelegateExecution execution) throws Exception {
pingback(); // however this works like

I find 1) clunky and I am reluctant to implement 2) so far, because it introduces more complexity.
Does anyone have ideas or hints for this?


1 Like

Hi Ben
Why not just use a service task with a connector to drive a callback. Hence your client could include the callback URL as a process variable. On process completion, the service task uses the URL in a connector to initiate callback.

Regards Rob


Two scenarios come to mind:

  1. If you are doing Sync Process Start Calls, then you can use the withVariablesInReturn parameter:

withVariablesInReturn Indicates if the variables, which was used by the process instance during execution, should be returned. Default value: false

  1. If you are doing aSync and basically need a promise, then I would look into what @Webcyberrob was mentioning. You can setup a Service Task, Message Throw Event, or Message Throw End Event that pings your client. Not knowing how your app is setup, you likely have a few options such as a generic socket you can ping back to through middleware, a message queue for the client, etc.

We actually use both Sync and aSync; where N tasks execute as a sync transaction and return the variables, and then it goes into the Job Executor/queue and when data needs to be pushed back to the client they are service tasks/send tasks/Message events back to middleware to ping the client.