Activiti / Camunda change boundary timer with variable

前端 未结 3 1200
走了就别回头了
走了就别回头了 2021-01-01 04:32

I got a special question regarding timer boundary events on a user task in Activiti/Camunda:

When starting the process I set the timer duration with a process variab

相关标签:
3条回答
  • 2021-01-01 05:16

    Solution is to have 2 out going sequence flow, one should be from boundary timer on task and another one should be from task it self, as shown in diagram added by @theFriedC. See following image also.

    Then you can use some exclusive gateway on 2nd sequence flow and reroute that back to same task with a new timer value.

    0 讨论(0)
  • 2021-01-01 05:18

    If the timer is running you can change dueDate of the timer by executing a signal. If a assginee requested more time, set new value of hurry and execute the signal. The old timer will be canceled and the new timer will be created with new due date.

    runtimeService.setVariable(execution.getId(), "hurry", newDueDate);
    runtimeService.signalEventReceived(signalName, execution.getId());
    

    Process with signal

    0 讨论(0)
  • 2021-01-01 05:18

    After some time of thinking I came up with a workaround like that:

    enter image description here

    I start the process with two variables. "hurry" is evaluated for the boundary timer. And "extendDeadline" is initialized with false. If the timer triggers and the process advances to the exclusive gateway, the value of "extendDeadline" is evaluated.

    If a user has changed the value of "extendDeadline" to true during the the timer was running the process returns to the user task again where the boundary timer is set to the value of "hurry".

    If the "extendDeadline" is still set to false, the process can proceed.

    0 讨论(0)
提交回复
热议问题