I have modelled a reminder process that has 4 different dates when it needs to trigger a reminder process. I used a event based gateway to link 4 intermediate timer events and set the type to date and use a variable as date value. The variables are pre calculated dates based on the scheduled date. What I expected is that the token will wait at the event based gateway till the first reminder timer event that has the oldest timer event to be triggered. This will sent a reminder and then loop the token back to the event based gateway and wait for the next event to be triggered. But the result is that the timer events with a fixed date that is in the past, is always triggered. That was not what I expected based on the training information. (maybe I misunderstood) if I put a catching event like 2018-01-01T00:00:00 (which is in the past) I would expect that this event will never be triggered because the exact date time has already past. I would like to know if this is the expected behaviour or this is a bug. I am using camunda BPM platform v7.7.0.
Thanks in advance for the help!
With kind regards,
have a look at this diagram: https://cawemo.com/share/be340807-7118-4154-947b-63c6f1ee91ea.
Maybe you can replace three noninterrupting timer events with an expression to calculate cycle due dates: https://docs.camunda.org/manual/7.10/reference/bpmn20/events/timer-events/#time-cycle
Hope this helps, Ingo
thanks for your answer. Yes both options are viable, I now changed the script to recalculate the next reminder date and is working as well.
But my initial question still remains, why when a token arrives at a timer event that has a date set in the past is automatically triggered. I would expect that the token would wait indefinitely for the event to trigger because the date already past.
Included a screenshot from the training material explaining timer events.
In this scenario: I thought when I was too late with buying the flowers my partner would never be woken
Thanks in advance for the clarification!
when a token arrives at the event based gateway, all timer events will be saved as jobs in the database. And jobs with a due date in the past will be executed in the next run of the job executor.
It queries with
... where dueDate <= now.
After a event based gateway you can only have a single timer event as only the first makes sense.
I double checked it with your example. You will wake your partner immediatly after buying the flowers if you run this process now.
Thanks for once again for your quick and clear response.
Then I probably wasn’t listening good enough to Niall during the training I thought I heard because the date time was definite the trigger would never be activated if it is in the past. But now I know and will model this in a different way. Thanks!
there may be a difference between the BPMN specification and the implementation in the engine. And I havn’t been in the Specification document for this point.
@j0hnli note that your original model has a race condition in it: where if your timer is executing at the same time as you receive the “Receive Finished Msg” event, then that event will not be received / be “uncorrelated”. This is because you only have a single “token”/ execution moving through your bpmn, thus when the token is on the timer it is not waiting for the finished msg event.
Your cleanest would be something like:
you could set your timer to execute on a Cron cycle like Every day at 9am. And then pass the deadline date as a variable in your message. Then all your actual timer logic about what to do for each of the N days before deadline would go in the Notification/Reminder process.