I have a process with timer(s).
When process execution flow reach the timer I would like to log a date my process will be triggered by the timer.
To do it I added ExecutionListener to my timer(s) for EVENTNAME_START event. The idea is: when execution reach the timer I can calculate next trigger date form these timer duration and log it.
The questions are:
Does my idea make sense, or there is a better way to do it?
If mentioned by me way is the only one - how to get duration of timer in my listener.
Thank you in advance,
Mike
I see that your way is a valid way…
And one easy way to get the value of timer duration is to store time duration in a variable where it’s name prefixed with timer Id. And from your listener you could retrieve the timer Id as follow.
I didn’t try it. But I think it should work.
execution.getBpmnModelElementInstance().getId()
Or more elegant way as follow
IntermidiateCatchEvent ice = (IntermidiateCatchEvent) execution.getBpmnModelElementInstance();
TimerEventDefinition ted = (TimerEventDefinition) ice.getEventDefinitions().iterator().next();
String value = ted.getTimeDuration().getTextContent();