Reputation: 390
I have written a Python pyzeebe
worker that is supposed to interact with my database using 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?
Upvotes: 1
Views: 228
Reputation: 307
Issue was fixed recently here. Upgrade to 4.0.0rc1 version.
pip install pyzeebe==4.0.0rc1
Upvotes: 2