Skip to main content

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 — для управления окружениями в tox
  • tox-docker — для запуска инфраструктурных сервисов, необходимых в тестах.

Быстрый старт

  1. Установите необходимые инструменты:
uv tool install tox --with tox-uv --with tox-docker
  1. Клонируйте репозиторий и перейдите в директорию проекта:
git clone ssh://git@stash.bars-open.ru:7999/edueo/librbac.git
cd librbac
  1. Запустите тесты и проверки:
tox

Проверка качества и форматирование кода

tox -e lint

Metadata

Release files for camunda-adapter 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for camunda-adapter 2.0.0
File Size Uploaded Provenance Actions
camunda_adapter-2.0.0.tar.gz 29.2 kB Without provenance Details for camunda_adapter-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for camunda-adapter 2.0.0
File Interpreter ABI Platform Actions
camunda_adapter-2.0.0-py3-none-any.whl Python 3 none any Details for camunda_adapter-2.0.0-py3-none-any.whl

Total release size: 61.5 kB

Release files / camunda_adapter-2.0.0.tar.gz

Download URL camunda_adapter-2.0.0.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2da575b4a4890319eb652f0784dbb0f007c613b3e41c5200b3739d7c1440cca0
BLAKE2b-256 checksum
How to use checksums
91b9d541651f7c618a2f1dd47fbe496ccb56b426a96ce2d97584999233db10fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / camunda_adapter-2.0.0-py3-none-any.whl

Download URL camunda_adapter-2.0.0-py3-none-any.whl
Size 32.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1be180e0227673502688734ba27dd3c46fa06637b4e30850f8939ee7fcad00a1
BLAKE2b-256 checksum
How to use checksums
f28fdb856559fc5c362ae4dbee6855bf321a69ec23b62c448bccceb18b90a284
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Security for camunda-adapter 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page