Flowable External Worker Library to connect Python code to Flowable using an external worker.
Project description
Flowable External Worker Library for Python
An External Worker Task in BPMN or CMMN is a task where the custom logic of that task is executed externally to Flowable, i.e. on another server. When the process or case engine arrives at such a task, it will create an external job, which is exposed over the REST API. Through this REST API, the job can be acquired and locked. Once locked, the custom logic is responsible for signalling over REST that the work is done and the process or case can continue.
This project makes implementing such custom logic in Python easy by not having the worry about the low-level details of the REST API and focus on the actual custom business logic. Integrations for other languages are available, too.
Authentication
The different ways to authenticate are explained in the documentation of the underlying requests HTTP library which is used to connect to Flowable.
The ExternalWorkerClient
accepts as a parameter auth
an implementation of requests.auth.AuthBase
.
There are default implementations for example for basic authentication e.g. HTTPBasicAuth("admin", "test")
.
Flowable offers a bearer token implementation FlowableCloudToken
which allows to specify an access token to the Flowable Cloud offering.
Sample
Cloud
The usage with Flowable Cloud is simpler, since everything is pre-configured. However, it's required to either use the user credentials or to pre-configure a personal access token.
from flowable.external_worker_client import ExternalWorkerClient
from flowable.external_worker_client.cloud_token import FlowableCloudToken
client = ExternalWorkerClient(auth=FlowableCloudToken("<personal-access-token>"))
def my_callback(job, worker_result_builder):
print('Executed job: ' + job.id)
return worker_result_builder.success()
subscription = client.subscribe('myTopic', my_callback)
Local
The following is an example how you can connect to a Flowable instance running at http://host.docker.internal:8090
and process all messages retrieved on the topic myTopic
:
from flowable.external_worker_client import ExternalWorkerClient
from requests.auth import HTTPBasicAuth
client = ExternalWorkerClient('http://localhost:8090/flowable-work', auth=HTTPBasicAuth("admin", "test"))
def my_callback(job, worker_result_builder):
print('Executed job: ' + job.id)
return worker_result_builder.success()
subscription = client.subscribe('myTopic', my_callback)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flowable.external-worker-client-1.0.0.tar.gz
.
File metadata
- Download URL: flowable.external-worker-client-1.0.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dad9e36603e7800591225bbc5032181b9e53f5171e66b752bf9986f2c1fe1701 |
|
MD5 | 5e173374b745896968c83b6dfbcd48ea |
|
BLAKE2b-256 | 1f8338ef77ac94d8810c00f6c28761f342a927a9d8734900d065a2be479aad50 |
File details
Details for the file flowable.external_worker_client-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: flowable.external_worker_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 278a6a1ef7a9593db9b8632447ab76ea50b8ca70ab2d425082ac022fc336b7da |
|
MD5 | 5f0a84c7f83a5e991abcfc637f94ffb8 |
|
BLAKE2b-256 | 5a2a78ffcfc452aa6503ee94dfcadd51510074206afa5d4648d9ff62f124afd5 |