cancel
Showing results for 
Search instead for 
Did you mean: 

#578 - Conditional BoundaryTimer

skay
Champ in-the-making
Champ in-the-making
Hi,
I have been stuck on an issue while trying to handle NULL expression on BoundaryTimer.
I'm just surprised that BPMN2.0 seems to be agnostic to that basic feature.

My use case need to trig on (ISO)duration execution variable : if NULL, the process does not launch the BoundaryTimer job.

So this is very simple, but the only way I find to do it properly is adding this feature in 5.18.0 future release see #578.

Tell me if you're OK with this pull request :
https://github.com/Activiti/Activiti/pull/578

BR
7 REPLIES 7

jbarrez
Star Contributor
Star Contributor
So basically you *don't* want to create the timer if it returns null?

skay
Champ in-the-making
Champ in-the-making
I don't want to schedule Timer Job if dueDate (as ISO time String) or date (as java.util.Date) attribute is null.

Currently if we just place a BoundaryTimer on a task (or subprocess) without any dueDate/date this is throwing a checked Exception.
An Exception at Runtime occurs if the dueDate attached execution variable is null.

The detailed need- Current process with transversal SLAs

A loop on a Human task with BoundaryTimer.

* Rule Engine decides a SLA (duration) -> this may be null (no SLA)
* "dueDate" String value as input of BoundaryTimer - computed from DateTime.now() + SLA - if SLA not null.
* SLA and start date are business value : we need to display them even if timer has expired.
* a process creation date is an other business value; diffrerent from startDate.
* "dueDate" is a local variable to the Human Task / the input of the Boundary timer
* Escalation when Timer expires is currently just an e-mail. But this must not cancel Human Task activity (cancel activity=false); and the mail must not be re-sent (e.g changes see Use Cases)

Use Cases :
1) 'administrator' may change SLAs values / in that case, a signal is thrown and all running Human Tasks with given SLA code kick out, and back to RE to re-decide SLA. startDate do not change, and computed new dueDate could decide a new Timer Job.
2)  supervisor may clear SLA OR change startDate for a specific running Human Task (so clears dueDate).
3) If Timer has been trigged once, we must NOT schedule timer again (!)

We need to inject NULL dueDate local variable if
a) computed dueDate is null
b) computed dueDate has aready been trigged.


I could achieve this duplicating the Human task : one BoundaryTimer and one other without.
An exclusive gateway could select if SLA value is present or not.
This is the simplest way to achive this.

BUT
I need a more general approach, and I would like not to duplicate any task (e.g. subprocess) with BoundaryTimer.
So I need support of NULL values on BoundaryTimer / result is no underlying Timer Job created.

skay
Champ in-the-making
Champ in-the-making
Conclusion :
With a very small change, I actually added a new feature : transversal SLA support Smiley Happy

jbarrez
Star Contributor
Star Contributor
OK, i understand the use case. And i see why you need duplication now, which isn't good.
We'll continue discussion further on the PR, when we go through the currently open PR's.

skay
Champ in-the-making
Champ in-the-making
Ok
Actually I Think that all this use case and underlying code could be wrapped into a single 'special' timer with dedicated icon : sla timer.
Or just an added attribute 'sla code' inside current timer / handling automatically sla changes with duration re-comptutation

jbarrez
Star Contributor
Star Contributor
That's possible, but it's hard to go beyond the default BPMN 2.0 icons. We've only done so in a very few times.
An attribute would work the same, no?

skay
Champ in-the-making
Champ in-the-making
Yes its true.
Yes - we could add an attribute for this; but first, the timer boundary must be able to handle a null duration / final time without launching any job.
This is the very basic change I proposed in the pull request.

Then we can imagine adding a new attribute.