Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/camunda-community-hub/script-connector
Zeebe worker for script evaluation
https://github.com/camunda-community-hub/script-connector
extension jsr223 scripting zeebe zeebe-worker
Last synced: about 1 month ago
JSON representation
Zeebe worker for script evaluation
- Host: GitHub
- URL: https://github.com/camunda-community-hub/script-connector
- Owner: camunda-community-hub
- License: apache-2.0
- Created: 2018-07-05T07:07:12.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-10-30T03:25:21.000Z (2 months ago)
- Last Synced: 2024-10-30T03:53:03.798Z (2 months ago)
- Topics: extension, jsr223, scripting, zeebe, zeebe-worker
- Language: Java
- Size: 482 KB
- Stars: 28
- Watchers: 8
- Forks: 21
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-camunda-platform-8 - Script - Zeebe job worker for evaluating JS, Groovy, Kotlin and FEEL scripts (Job Workers)
README
# Script Connector
[![](https://img.shields.io/badge/Community%20Extension-An%20open%20source%20community%20maintained%20project-FF4700)](https://github.com/camunda-community-hub/community)
[![](https://img.shields.io/badge/Lifecycle-Stable-brightgreen)](https://github.com/Camunda-Community-Hub/community/blob/main/extension-lifecycle.md#stable-)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)[![Compatible with: Camunda Platform 8](https://img.shields.io/badge/Compatible%20with-Camunda%20Platform%208-0072Ce)](https://github.com/camunda-community-hub/community/blob/main/extension-lifecycle.md#compatiblilty)
_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` or `zeebeClient` anymore.
Example BPMN with service task:
```xml
```
* 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](./connector/element-templates/script-connector.json) that can be used to configure it.
### Script languages
Available script languages are by default:
* [javascript](https://www.graalvm.org/) (GraalVM JS)
* [groovy](http://groovy-lang.org/)
* [mustache](http://mustache.github.io/mustache.5.html)
* [kotlin](https://kotlinlang.org/)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`](./connector/src/main/java/io/camunda/community/connector/script/spi/ScriptEvaluatorExtension.java) SPI.
To register custom file extensions, you can use the [`LanguageProviderExtension`](./connector/src/main/java/io/camunda/community/connector/script/spi/LanguageProviderExtension.java) SPI.
## Install
### Docker
For a local setup, the repository contains a [docker-compose file](docker/docker-compose.yml). 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
1. Download the runtime jar `script-connector-runtime-{VERSION}.jar`
2. Start the connector runtime `java -jar script-connector-runtime-{VERSION}.jar`#### Bundled Runtime
1. Download the shaded connector jar `script-connector-{VERSION}-shaded.jar`
2. Copy it to your connector runtime.## Code of Conduct
This project adheres to the Contributor Covenant [Code of
Conduct](/CODE_OF_CONDUCT.md). By participating, you are expected to uphold
this code. Please report unacceptable behavior to [email protected].