camunda-community-hub / pyzeebe

Python client for Zeebe workflow engine
https://camunda-community-hub.github.io/pyzeebe/
MIT License
87 stars 37 forks source link

Restrict Worker to Process #501

Closed maximilianbehr closed 2 weeks ago

maximilianbehr commented 1 month ago

Is it possible to restrict a worker to a specific process and version?

barthansen commented 1 month ago

I was looking for the same..

dimastbk commented 1 month ago

It is not possible in Zeebe GRPC API

barthansen commented 1 month ago

@maximilianbehr

I use this info to restrict access for now..



from pyzeebe import ZeebeWorker

worker = ZeebeWorker()

@worker.task(task_type="my-task")
def handle_task(job):
    process_instance_key = job.process_instance_key
    process_definition_key = job.process_definition_key
    bpmn_process_id = job.bpmn_process_id
    element_id = job.element_id

    print(f"Process instance key: {process_instance_key}")
    print(f"Process definition key: {process_definition_key}")
    print(f"BPMN process id: {bpmn_process_id}")
    print(f"Task element id: {element_id}")