Timer event as a boundary event

timer-task.bpmn (18.7 KB)
As can be seen in my process, I have a subprocess that includes a Timer Event. If the subprocess is not resolved within 45 seconds, it proceeds to the final task. My question is, when I execute the process, when does the timer start? Does the timer begin when the task is accepted and initiated, or does it start when the task appears in the task list but the respective user has not accepted the task?

Hello my friend!

In this BPM you sent, the timer will start counting from the moment the instance enters the subprocess.

As soon as the “Choose movie” task is completed, the instance will enter the subprocess and the timer will start counting.

I hope this helps.
William Robert Alves

If you want the time to start counting from the moment the task appears in the task list, that is, when the instance ARRIVES in the task… you must place your timer on the edge of the task, and not on the subprocess.

William Robert Alves

Is there a difference now if I set the timer on a task or subprocess? Does it mean that in the subprocess, the timer starts later? Would it be possible to configure the timer to begin only when the user starts the task?

Its timer will always start counting from the moment the processInstance arrives at the point the timer is wrapping.

For example, if you put a timer on a User task… when your processInstance arrives on the user task, regardless of whether the user has accepted the task or not, it will start counting.

If you put the timer in a Subprocess, when your processInstance enters this subprocess, the time will start counting.

To clarify, are both the same or not?

A timer is a timer… the behavior will always be the same, so as I explained above, when the instance arrives at the place where you placed the timer, it will start counting.

To get the behavior you want, which starts the timer when the user starts the task… you’ll have to create a logic to check when the user CLAIMs the task, and then fire some event that starts your timer, something along those lines and when the timer ends, trigger an messageCorrelate for example to be received by some message boundary event in your User task, and this will throw your instance to another path, as soon as the timer ends.

But this is the way that maybe I would do it being in Camunda 7… in Camunda 8 I really don’t know what can be done, because I still don’t have enough knowledge about caunda 8.

A Timer Boundary event will always start counting when the token reaches that activity.

Sub-Proc-A has a timer associated to it for 35s. This timer will start as soon as the process starts.
Task A has a timer associated to it for 15s If Task A is not completed within 15s, the overall Sub-Proc-A will end with the “Sub-Timer” error.
Task C1 has a timer associated to it for 5s. This timer will start as soon as Task B is completed.
Task C has a timer associated to it for 15s. This timer will start as soon as Task B is completed, however due to the nature of this process, it will never go off.

This is a fictional, but poor, example, as it would be unlikely for the Sub-Proc-A timer to actually expire (Task A would need to complete in 15s without tripping its timer, Task B in 15s without tripping its timer, and Task C1 in 5s without tripping its timer)

It is not the BPM engine (Camunda)'s job to coordinate how long “after claim” the task is completed. It wants the tasks done as fast as they can be done. If there’s a deadline, it needs to be met, regardless of if someone has claimed the task.

1 Like

So if I understand correctly, you’re saying that logic should be implemented in the form of a programming code.

I have a question, but shouldn’t the timer on the image for sub procedure A be 45 seconds, and for task c be 10 seconds instead of 15 seconds as shown in the picture?

Apologies.
I had adjusted time values a few times trying to make values that would make sense.

Sub Proc A would be 35 seconds (Look at the timer to the right of the “Sub-Timer” Boundary Error Catch)
Task C would be 15 seconds (Look at the timer to the left of the “C1” Boundary Error Catch)

I’ve corrected the values in the post above.

So even though Task A, Task B, and Task C each have 15 second timers, they cannot each take their maximum time, or the Sub Proc A timer would go off.

For this specific case you mentioned, in which the timer starts counting only after the user accepts and initiates the task, yes, it needs to be done programmatically.

But if you need the timer to start counting as soon as the task is available for someone to execute (when the instance reaches the user task), or when the user completes the task, this can be accomplished without coding.

William Robert Alves

Thank you for your answer.

Thank you so much