A Zeebe worker to evaluate scripts (i.e. script tasks). Scripts are useful for prototyping, to do (simple) calculations, or creating/modifying variables.
Example BPMN with service task:
<bpmn:serviceTask id="scripting" name="Evaluate the Script">
<bpmn:extensionElements>
<zeebe:taskDefinition type="script" />
<zeebe:taskHeaders>
<zeebe:header key="language" value="javascript" />
<zeebe:header key="script" value="a + b" />
</zeebe:taskHeaders>
</bpmn:extensionElements>
</bpmn:serviceTask>
- the worker is registered for the type
script
- required custom headers:
language
- the name of the script languagescript
- the script to evaluate
- available context/variables in script:
job
(ActivatedJob) - the current jobzeebeClient
(ZeebeClient) - the client of the worker
- the result of the evaluation is passed as
result
variable
Available script languages:
The docker image for the worker is published on GitHub Packages.
docker pull ghcr.io/camunda-community-hub/zeebe-script-worker:1.0.0
- configure the connection to the Zeebe broker by setting
zeebe.client.broker.contactPoint
(default:localhost:26500
)
For a local setup, the repository contains a docker-compose file. It starts a Zeebe broker and the worker.
cd docker
docker-compose up
-
Download the latest worker JAR (zeebe-script-worker-%{VERSION}.jar )
-
Start the worker
java -jar zeebe-script-worker-{VERSION}.jar
The worker is a Spring Boot application that uses the Spring Zeebe Starter. The configuration can be changed via environment variables or an application.yaml
file. See also the following resources:
zeebe:
client:
worker:
defaultName: script-worker
defaultType: script
threads: 3
job.timeout: 10000
broker.contactPoint: 127.0.0.1:26500
security.plaintext: true
Build with Maven
mvn clean install
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].