No project description provided
Project description
camunda-client
This package includes clients such as CamundaEngineClient and ExternalTaskClient
In addition, there is an ExternalTaskWorker for working with ExternalTask
Installing
pip
pip install camunda-client
pdm
pdm add camunda-client
ExternalTask functional usage
Source code in examples/external_task
from camunda_client.worker import ExternalTaskWorker
from .enums import WorkerEnum
async def subscribe(
topic: str,
task_worker: ExternalTaskWorker,
) -> None:
mapping = WorkerEnum.workers()
async with task_worker.subscribe(topic) as task_contexts:
async for task_context in task_contexts:
async with task_context as task_dto:
worker_cls = mapping[task_dto.topic_name]
# Resolve the dependency on the DI container.
# This initialization is provided as an example.
worker = worker_cls()
result = await worker.execute(task_dto)
if result.is_success is False:
print(f"Task with id {task_dto.id} was failed")
await task_context.fail(error_message=result.message)
else:
print(f"Task with id {task_dto.id} was completed")
await task_context.complete()
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
camunda_client-0.4.10.tar.gz
(16.6 kB
view hashes)
Built Distribution
Close
Hashes for camunda_client-0.4.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15c44272a83689bf036e0a4ba5d3b96a390bba2a6398c085dcb93cd1e7337ef2 |
|
MD5 | 2a1f7b000af9744d29a42768856e9d56 |
|
BLAKE2b-256 | 3f547ba69d96b3f48ae32af0b33c8b5f9a7001f53ebbe165e519bb12d7c29dd2 |