Skip to main content
Version: latest

Send tasks

A send task is used to model the publication of a message to an external system, for example, to a Kafka topic.

task

Send tasks behave exactly like service tasks. Both task types are based on jobs and job workers. The differences between these task types are the visual representation (i.e. the task marker) and the semantics for the model.

When a process instance enters a send task then it creates a corresponding job and wait for its completion. A job worker should request jobs of this job type and process them. When the job is completed then the process instance continues.

info

Jobs for send tasks are not processed by Zeebe itself. In order to process them, you need to provide a job worker.

Defining a task#

A send task must define a job type. It specifies the type of job that workers should subscribe to (e.g. kafka).

Use task headers to pass static parameters to the job worker (e.g. the name of the topic to publish the message to).

Define variable mappings to transform the variables that are passed to the job worker, or to customize how the variables of the job are merged in the process instance.

Additional resources#

Community Extension

Have a look at the Kafka Connect Zeebe. It's a community extension that provides a job worker to publish messages to a Kafka topic. You can run it, or use it as a blueprint for your own job worker.

XML Representation#

A script task with a custom header:

<bpmn:sendTask id="publish-message" name="Publish message">  <bpmn:extensionElements>    <zeebe:taskDefinition type="kafka" />    <zeebe:taskHeaders>      <zeebe:header key="kafka-topic" value="payment" />    </zeebe:taskHeaders>  </bpmn:extensionElements></bpmn:sendTask>

References#