Unable to update Timer DueDate and Activate it at the same time

Hi All, new here so please bear with me. Open for tips on how to improve my questions.

Using Camunda 7.12.

I have a TaskListener hooked up to a User Task on the ‘assign’ event.
This User Task also contains an intermediate timer with a due date. To allow this user task
to be skipped if it isn’t picked up by a user in due time.

-1- on assign: if assignee != null (task is claimed) - suspend the intermediate timer
-2- on assign: if assignee == null (task is unclaimed) - re-activate the intermediate timer

Goal here is to, once assigned, allow for the user to take as much time to handle this task as
she/ he wants to. but to proceed the task to the next step in the process as soon as it is not assigned to a user anymore.

Situation -2- has two possible states:

  • it happens before the due date
  • it happens after the due date

If the event happens after the due date I want to provide some leeway - it might be that the unclaim happened to still allow for a takeover by another user (although, yes I know: the due date has passed)

so in this particular situation (unassign after due date) in the TaskListener I use the ManagementService to:

  • update the due date to now() + 1H, and then
  • activate the timer

This, however fails due to the well-known Optimistic Lock exception

Am I doing something wrong here ? Is there a better way of achieving this implementation ?

Thank you very much in advance,

Kind regards, Dennis

1 Like

I’m also interested in how to support this scenario, but would have gone for the same approach. How to prevent this from failing?