Options to Invoke - External Task MS from BPMN Flows

Hi @stephenbalben_joel

Lets take an example:

image

The “3rd Party Code” is an external task configued like this:

image

The external task pattern was created to support components outside the process application to participate in a process flow.
This way you can have software components written in different programming languages - .NET, PHP etc. They just need to be able to call the Camunda REST API.
Such components are called external task workers.

To be able to support this, it’s actually not the Camunda process engine that calls these external components. The external components are calling the Camunda REST API asking Camunda for external tasks.

Once the Camunda process engine reaches an external task (the “3rd Party Code” in the example above), a task is created (and stored inside the Camunda DB).
Now Camunda will wait for an external component to mark the task as completed, and only then, the process flow will continue.

External task workers must do the following:

  1. Poll the Camunda API for tasks (using a topic name). If a task is returned it will be claimed and locked by the task worker.

  2. The task worker must run the code needed to complete the task (notice, that this code is executed outside Camunda)

  3. Once the code is completed, the task worker must call the Camunda API to mark the task as completed (or failed if the task worker code fails).

All task workers will run inside such a loop.

Regarding your question about timeout - first of all, if a process reaches an external task, this task will remain there until it is marked as completed.
Only then will the process continue. There is no timeout here.

However, if an external task has been claimed by an external task worker, the task is then locked and assigned to that worker, and if that worker does not complete the task (or mark it as failed) within a given period of time, the lock on the external task will be released and the task will be available for other external task workers (using the same topic name).

This period of time is called “lock duration” and it must be provided when external task workers claim and lock an external task.
So it is the external task workers that specify how long Camunda should keep the lock on a task.

Hope that helps.

BR
Michael