Timer Event (after or before a Task)

Can I set the timer event in Camunda to determine when the task starts or when it ends, so that the entire process stops?

Hello my dear!

Yes! You can!
If you only want your current task to finish when the timer activates, do something like this.

image

If you want the instance to stop running completely in your workflow, you can wrap everything in an expanded sub-process.

image

Regards.
William Robert Alves

Now I understand. So, as you showed me, the Timer Task fulfills both waiting for the task to be executed and determining when it ends. Did I understand it correctly? Since you mentioned “type Duration,” I wanted to ask if any programming is required.

Not quite.
An Intermediate Timer in the flow of a process will wait at the timer for the time defined in the timer.
A Boundary Interrupting Timer (Timer on the side of the task) will STOP the task if the task is still running when the amount of time defined in the timer has elapsed. If the task has already stopped, the timer will not do anything.

There’s a LOT of documentation on the BPMN components.

You seem to be interesting in knowing “When” a task ended (eg. Time how long a task ran) … That is out of scope for a BPMN process. You can use a reporting system (like Optimize) to determine that information.

Oh, I meant, for example, that the task starts in 10 minutes. As you mentioned, it is possible, but, for example, the task is available for about 15 minutes and the process runs. Would it be possible to set a specific time, so that the end time is not possible? How would you do it with optimization?

You still seem to have a flawed concept of how BPMN works. BPMN is not a UI on its own.

What do you mean by “the task starts in 10 minutes”?
What do you mean by " is available for about 15 minutes"?

The task is part of the process, so as long as the task is active, the process is running.

Optimize is about reporting, not running the process. It’s looking back at the process and saying “Task A started at Time X and ended at Time Y”, which allows you to figure out how long Task A was active.

Think of the BPMN Engine like a Parent, telling a child what to do…

“I’ll wake you up in the morning, and you need to get ready for the day”

The timer start will cause the process to start when the time hits a particular time.
How the child completes the “Wake Up” task doesn’t really matter to the parent… it just matters that it happens.
The parent then tells the child to have a shower. If the child continues having a shower for more than 15 minutes, the parent will just turn the water off (can’t waste water, right?).
Regardless of how the shower ended, the child will then be told to get dressed.
Once dressed (again, we don’t really care HOW they got dressed, just that they did), the child will be told to eat breakfast.

The Engine doesn’t really have a strong concept of “Wake up should only be available for 15 minutes”… The Task needs to be done, it doesn’t matter how.

I have understood the principle. For example, the task should start at 8 AM. This can be done in BPMN, right? My idea would be that if the task is not completed by 6 PM, the entire process should be automatically terminated. Sorry for disturbing you all.

You’re not disturbing anyone!

Do you want the Engine to be responsible for the process starting, or some external scheduler to be responsible for it?
In the example flow above, the Parent is watching the clock. As soon as they notice that it’s 0800, they start the “Get Child Ready for Day” process. But… It could be some other external system (say a reminder on their Smartphone) that tells the Parent to start the “Get Child Ready for Day” process.

But. What happens if there’s more than one child to get ready each day?
What about chores that the child should do?
What about chores that a child should do (but only one of children should do it)?

If you think about the overall processes like a parent guiding children (and maybe pets that only know how to do ONE thing), it becomes a lot easier to understand how to model them.

So, if I understand correctly, you want to be able to set a specific start time for a task, such as 8 AM. However, you cannot configure it so that if the task is not completed by 6 PM, it should be removed, and the token should disappear, for example, using an AND-split. Is it possible to specify a deadline for a task in terms of a specific time? Thank you for your help.

It’s possible to model it, but it would get really ugly to try to model “deadlines” for each task.
Instead of trying to ask “Here’s my solution, how do I implement it in BPMN”, what is the underlying goal?

You have to put all the steps into a subprocess, and then put a timer against that subprocess, so that the timer applies to all the steps within it.

In your example of 0800 - 1800, the timer for the overall process would be 10h…

My goal is to automate a process that meets my requirements. Would that be the wrong goal? So, as I understood it, in the end, I can easily set the task to start at 8 am. But if the “Get Ready for the day” task is not completed by 6 pm, can I immediately set a terminated event? Can I write 6 pm instead of 1 hour so that the process stops? Should I model it to show exactly what I mean?

You won’t be able to put 6PM in the timer, as it expects a duration.

You CAN model it exactly as we both have described, but it might not be a good solution. Since you’re not willing to expand on your needs, I cannot tell you if it’s a good fit.

An Interrupting Boundary task will end all tasks that its attached to (so regardless of which step in the Get Ready Process the child is on, they will be told to stop what they’re doing and go out the door… Potentially awkward!)

It’s important to initially think in terms of a Parent / Child, since that will work if a person is doing the task or a automation is doing the task. If you think too far in terms of automation, you’ll lose separation between the engine and the workers.

To summarize, does it mean that you can only specify when a task should be executed and not until when it should be available? Right?

No.
As explained previously, When a BOUNDARY TIMER exceeds its duration, it will terminate all tasks that it is attached to.

Oh, I see. Can we understand it like this: if it is an intermediate event, then the task should start at 8 o’clock? And as you demonstrated with the boundary timer event, can I say that if you don’t complete the task within 1 hour, the process will end? Is that what you were trying to convey?

A Timer Start Event will cause a new instance of a process to start each time the timer conditions are met.
An Intermediate Timer event will wait at the timer until its duration expires, and will then continue to the next task.
A Boundary Timer Event will end any task(s) that it is attached to when its duration expires.

For example a Timer Start Event starts 8 am.
An Intermediate Timer means for example you make a coffee and after 10 minutes you should work again. It means you have only 10 minutes to do your coffee.
A Boundary Timer Event means that if after 15 minutes nothing happens it end.

Did I understand it correctly?

Not quite.

Timer Start → New Process at 8 am (Correct)

Intermediate Timer will always wait the amount of time specified. If you have a task “Make Coffee” and then an Intermediate Timer “10 minutes”, even if the worker is ready to go back to work in less than 10 minutes, then there will be nothing to do as the next task won’t happen until the timer expires.

Boundary Timer → If you are still doing something after the timer expires, you will be told to stop. (See shower example and parent turning the water off)

Thank you very much. Thank you, you’re the best. Do you have to program anything for Timer Events? Hopefully not because I’m struggling with programming and was thinking of posting a thread about it because it’s too much for me, and there are many different things on GitHub.