Hello everyone
I’m working on a project that heavily relies on user-tasks, but instead of using the tasklist API, it manages them through an own service and database table.
The service has a worker listening to the io.camunda.zeebe.userTask
type with a 10-second timeout. When a new task comes in, it’s stored in the database; if it already exists, we simply extend its validity. When a user wants to complete a task, they send a request to our tasklist service, which then completes the user-task (job) via the Zeebe client and removes it from the database. If no task is received for a given time (x seconds), we assume it’s completed or canceled, and mark it as expired.
The Issue
If a user-task gets canceled (for example, via a message boundary event), the cancellation isn’t reflected in the events from io.camunda.zeebe.userTask
. Our service continues to believe the task is active until the timeout expires and it’s marked as expired. This means that if someone queries the task before the timeout, it appears open, only to hit an exception when trying to complete it because it no longer exists in Zeebe.
While the problem eventually resolves after the timeout, it creates a window where inconsistencies can lead to issues.
Question
I’ve heard that listening to io.camunda.zeebe.userTask
is a common pattern, so I’m wondering if there’s a straightforward way to detect or receive notifications about canceled user-tasks without resorting to building a custom exporter. Are there any best practices or alternative approaches that could help keep the external service in sync more accurately?
What I’ve Tried / Considered
- Execution & Task Listeners: At least the execution listener, does not seem seem to capture cancellation events.
- Custom Zeebe Event Exporter: This might work but introduces additional complexity that I’d prefer to avoid.
Any insights or suggestions would be greatly appreciated. Thanks in advance!