script-connector
script-connector copied to clipboard
Zeebe worker for script evaluation
Script Connector
This is a community project that provides a connector. It is not officially supported by Camunda. Everybody is invited to contribute! A connector to evaluate scripts (i.e. script tasks) that are not written in FEEL. Scripts are useful for prototyping, to do (simple) calculations, or creating/modifying variables.
Usage
Legacy
The legacy connector provides compatibility with the previous implementation zeebe-script-worker
.
The context does not offer access to
job
orzeebeClient
anymore.
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:header key="resultVariable" value="result" />
</zeebe:taskHeaders>
</bpmn:extensionElements>
</bpmn:serviceTask>
- the worker is registered for the type
script
- required custom headers:
-
language
- the name of the script language -
script
- the script to evaluate -
resultVariable
- the result of the evaluation is passed to this variable
-
Connector
The connector provides an element template that can be used to configure it.
Script languages
Available script languages are by default:
- javascript (GraalVM JS)
- groovy
- mustache
- kotlin
To register new script languages, you can use the ScriptEngineFactory
to register any JSR-223 compliant script engine.
If you want to provide a non-compliant implementation, you can use the ScriptEvaluatorExtension
SPI.
To register custom file extensions, you can use the LanguageProviderExtension
SPI.
Install
Docker
For a local setup, the repository contains a docker-compose file. It starts a Zeebe broker and both (standalone and bundled) containers.
mvn clean package
cd docker
docker-compose up
Standalone Runtime
The docker image for the connector runtime is published as GitHub package.
docker pull ghcr.io/camunda-community-hub/script-connector/runtime:latest
Configure the connection to the Zeebe broker by setting the environment property ZEEBE_CLIENT_BROKER_GATEWAY-ADDRESS
(default: localhost:26500
)
The docker-compose file shows an example how this works.
Bundled Runtime
To run the connector inside the bundle, you can use the shaded jar.
The docker-compose file shows an example how this works.
Manual
Standalone Runtime
- Download the runtime jar
script-connector-runtime-{VERSION}.jar
- Start the connector runtime
java -jar script-connector-runtime-{VERSION}.jar
Bundled Runtime
- Download the shaded connector jar
script-connector-{VERSION}-shaded.jar
- Copy it to your connector runtime.
Code of Conduct
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].