Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot fetch Camunda job variables in pyzeebe worker #382

Closed
okaeiz opened this issue Jan 27, 2024 · 1 comment · Fixed by #404
Closed

Cannot fetch Camunda job variables in pyzeebe worker #382

okaeiz opened this issue Jan 27, 2024 · 1 comment · Fixed by #404

Comments

@okaeiz
Copy link

okaeiz commented Jan 27, 2024

I have written a python pyzeebe worker that is supposed to interact with my database usinng the values that the variables of the previous user task in the Camunda BPMN hold. I have defined a user task with a form. I have also created a service task and defined the taskDefinition. It seems like the worker can indeed communicate with my zeebe but it is unable to fetch the variables of the form.

from pyzeebe import ZeebeWorker, Job, create_insecure_channel
import asyncio
import psycopg2
import logging
async def handle_database_transaction(job: Job) -> dict:
    variables = job.variables

    # Log the received variables at INFO level
    logging.info(f"Received variables: {variables}")

    selected_date = variables.get('selected_date')
    selected_project_id = int(variables.get('selected_project_id')) if variables.get('selected_project_id') else None

    # Log the extracted field values
    logging.info(f"Selected date: {selected_date}, Project ID: {selected_project_id}")

    # if selected_date and selected_project_id is not None, I perform the insert query with my database.

    return {}

And here is the MappingIO in my BPMN:

<zeebe:ioMapping>
   <zeebe:output source="=select_0swn49" target="output_project" />
   <zeebe:output source="=datetime_gporzh" target="output_date" />
</zeebe:ioMapping>
<zeebe:ioMapping>
   <zeebe:input source="=output_project" target="selected_project_id" />
   <zeebe:input source="=output_date" target="selected_date" />
</zeebe:ioMapping>

What part of the procedure am I doing wrong?

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version 120.0.6099.227

Additional context
This issue seems to be raised by other before. Just making sure...
#311
#315

@ChrisKujawa
Copy link

See #315 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants