Zeebe JobWorker binding spec

Detailed documentation on the Zeebe JobWorker binding component

Component format

To setup Zeebe JobWorker binding create a component of type bindings.zeebe.jobworker. See this guide on how to create and apply a binding configuration.

See this for Zeebe JobWorker documentation.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. spec:
  6. type: bindings.zeebe.jobworker
  7. version: v1
  8. metadata:
  9. - name: gatewayAddr
  10. value: <host>:<port>
  11. - name: gatewayKeepAlive
  12. value: 45s
  13. - name: usePlainTextConnection
  14. value: true
  15. - name: caCertificatePath
  16. value: /path/to/ca-cert
  17. - name: workerName
  18. value: products-worker
  19. - name: workerTimeout
  20. value: 5m
  21. - name: requestTimeout
  22. value: 15s
  23. - name: jobType
  24. value: fetch-products
  25. - name: maxJobsActive
  26. value: 32
  27. - name: concurrency
  28. value: 4
  29. - name: pollInterval
  30. value: 100ms
  31. - name: pollThreshold
  32. value: 0.3
  33. - name: fetchVariables
  34. value: productId, productName, productKey
  35. - name: autocomplete
  36. value: true

Spec metadata fields

FieldRequiredBinding supportDetailsExample
gatewayAddrYInputZeebe gateway addresslocalhost:26500
gatewayKeepAliveNInputSets how often keep alive messages should be sent to the gateway. Defaults to 45 seconds45s
usePlainTextConnectionNInputWhether to use a plain text connection or nottrue,false
caCertificatePathNInputThe path to the CA cert/path/to/ca-cert
workerNameNInputThe name of the worker activating the jobs, mostly used for logging purposesproducts-worker
workerTimeoutNInputA job returned after this call will not be activated by another call until the timeout has been reached; defaults to 5 minutes5m
requestTimeoutNInputThe request will be completed when at least one job is activated or after the requestTimeout. If the requestTimeout = 0, a default timeout is used. If the requestTimeout < 0, long polling is disabled and the request is completed immediately, even when no job is activated. Defaults to 10 seconds30s
jobTypeYInputthe job type, as defined in the BPMN process (e.g. <zeebe:taskDefinition type=”fetch-products” />)fetch-products
maxJobsActiveNInputSet the maximum number of jobs which will be activated for this worker at the same time. Defaults to 3232
concurrencyNInputThe maximum number of concurrent spawned goroutines to complete jobs. Defaults to 44
pollIntervalNInputSet the maximal interval between polling for new jobs. Defaults to 100 milliseconds100ms
pollThresholdNInputSet the threshold of buffered activated jobs before polling for new jobs, i.e. threshold * maxJobsActive. Defaults to 0.30.3
fetchVariablesNInputA list of variables to fetch as the job variables; if empty, all visible variables at the time of activation for the scope of the job will be returnedproductId, productName, productKey
autocompleteNInputIndicates if a job should be autocompleted or not. If not set, all jobs will be auto-completed by default. Disable it if the worker should manually complete or fail the job with either a business error or an incidenttrue,false

Binding support

This component supports input binding interfaces.

Input binding

Variables

The Zeebe process engine handles the process state as also process variables which can be passed on process instantiation or which can be updated or created during process execution. These variables can be passed to a registered job worker by defining the variable names as comma-separated list in the fetchVariables metadata field. The process engine will then pass these variables with its current values to the job worker implementation.

If the binding will register three variables productId, productName and productKey then the worker will be called with the following JSON body:

  1. {
  2. "productId": "some-product-id",
  3. "productName": "some-product-name",
  4. "productKey": "some-product-key"
  5. }

Note: if the fetchVariables metadata field will not be passed, all process variables will be passed to the worker.

Headers

The Zeebe process engine has the ability to pass custom task headers to a job worker. These headers can be defined for every service task. Task headers will be passed by the binding as metadata (HTTP headers) to the job worker.

The binding will also pass the following job related variables as metadata. The values will be passed as string. The table contains also the original data type so that it can be converted back to the equivalent data type in the used programming language for the worker.

MetadataData typeDescription
X-Zeebe-Job-Keyint64The key, a unique identifier for the job
X-Zeebe-Job-TypestringThe type of the job (should match what was requested)
X-Zeebe-Process-Instance-Keyint64The job’s process instance key
X-Zeebe-Bpmn-Process-IdstringThe bpmn process ID of the job process definition
X-Zeebe-Process-Definition-Versionint32The version of the job process definition
X-Zeebe-Process-Definition-Keyint64The key of the job process definition
X-Zeebe-Element-IdstringThe associated task element ID
X-Zeebe-Element-Instance-Keyint64The unique key identifying the associated task, unique within the scope of the process instance
X-Zeebe-WorkerstringThe name of the worker which activated this job
X-Zeebe-Retriesint32The amount of retries left to this job (should always be positive)
X-Zeebe-Deadlineint64When the job can be activated again, sent as a UNIX epoch timestamp

Last modified July 27, 2022: Add Zeebe autocomplete flag (#2673) (1501480b)