A service task represents a work item in the process with a specific type.
When a service task is entered then a corresponding job is created. The process instance stops at this point and waits until the job is completed.
A worker can subscribe to the job type, process the jobs and complete them using one of the Zeebe clients. When the job is completed, the service task gets completed and the process instance continues.
A service task must have a
taskDefinition. It specifies the type of job which workers can subscribe to.
taskDefinition can specify the number of times the job is retried when a worker signals failure (default = 3).
Usually, the job type and the job retries are defined as static values (e.g.
order-items) but they can also be defined as expressions (e.g.
= "order-" + priorityGroup). The expressions are evaluated on activating the service task and must result in a
string for the job type and a
number for the retries.
A service task can define an arbitrary number of
taskHeaders. They are static metadata that are handed to workers along with the job. The headers can be used as configuration parameters for the worker.
By default, all job variables are merged into the process instance. This behavior can be customized by defining an output mapping at the service task.
Input mappings can be used to transform the variables into a format that is accepted by the job worker.
A service task with a custom header: