Адаптер для BPMN-движка Camunda
Project description
camunda-adapter
Пакет предоставляет адаптер к платформе Camunda для приложений на Python.
Установка
$ pip install camunda-adapter
Подключение и настройка
См. тестовое приложение src/testapp.
apps.py:
Инстанцируется Config с параметрами конфигурации, затем инстанцируется Adapter.
При необходимости работы с внешними задачами, регистрируются обработчики задач путем подписки на соответствующие топики задач.
from django.apps import AppConfig as AppConfigBase
from camunda_adapter.adapters import Adapter
from camunda_adapter.config import Config
class AppConfig(AppConfigBase):
name = __package__
def ready(self):
self._setup_bpmn()
def _setup_bpmn(self):
from testapp import core
from . import services
core.config = Config()
core.adapter = Adapter(core.config)
for topic, handler in (
(services.topic1, services.topic_handler1),
(services.topic2, services.topic_handler2),
(services.topicN, services.topic_handlerN),
):
core.adapter.register_topic_handler(topic, handler)
services.py:
from camunda_adapter.domain import model as camunda
topic1 = camunda.Topic(name='topic-1')
def topic_handler1(task: camunda.ExternalTask, adapter: Adapter):
...
topic2 = camunda.Topic(name='topic-2')
def topic_handler2(task: camunda.ExternalTask, adapter: Adapter):
...
topicN = camunda.Topic(name='topic-N')
def topic_handlerN(task: camunda.ExternalTask, adapter: Adapter):
...
Примеры непосредственного обращения к адаптеру:
Отправка сообщения:
message = model.Message(
messageName='DeclarationReceived',
businessKey=f'attestation-declaration-{declaration.id}',
processVariables={
name: model.Variable(value=value)
for name, value in declaration.dict(include={'id'}).items()
}
)
message_results: List[model.MessageResult] = list(adapter.message(message))
Получение списка доступных задач:
adapter.get_external_tasks(definition=definition)
Выполнение доступных задач:
adapter.process_external_tasks()
Работа над пакетом
Подготовка среды разработки
Необходимый набор инструментов:
tox— оркестрация окружений и запуск командtox-uv— для управления окружениями в toxtox-docker— для запуска инфраструктурных сервисов, необходимых в тестах.
Быстрый старт
- Установите необходимые инструменты:
uv tool install tox --with tox-uv --with tox-docker
- Клонируйте репозиторий и перейдите в директорию проекта:
git clone ssh://git@stash.bars-open.ru:7999/edueo/librbac.git
cd librbac
- Запустите тесты и проверки:
tox
Проверка качества и форматирование кода
tox -e lint
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file camunda_adapter-2.0.0.tar.gz.
File metadata
- Download URL: camunda_adapter-2.0.0.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2da575b4a4890319eb652f0784dbb0f007c613b3e41c5200b3739d7c1440cca0
|
|
| MD5 |
9a005a8ce87b02543ad824cd681b0ffe
|
|
| BLAKE2b-256 |
91b9d541651f7c618a2f1dd47fbe496ccb56b426a96ce2d97584999233db10fb
|
File details
Details for the file camunda_adapter-2.0.0-py3-none-any.whl.
File metadata
- Download URL: camunda_adapter-2.0.0-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1be180e0227673502688734ba27dd3c46fa06637b4e30850f8939ee7fcad00a1
|
|
| MD5 |
29e4808f7386a357ef367a74b8b72e39
|
|
| BLAKE2b-256 |
f28fdb856559fc5c362ae4dbee6855bf321a69ec23b62c448bccceb18b90a284
|