Monday, August 8, 2011

Using timers in BPM 11g Part 2


A typical batch style process -
The process starts at 10 am and writes out a report every hour.
It ends 6 hours later at 4 pm.

Now for testing purposes I will start at 2:40 pm, write a report every 1 minute and then end 5 minutes later - but you can extrapolate as required.

The process is as follows -

Start is set to 14:40

The variable v_endTimeString will be set to startTime (i.e. 14:40) + 5 minutes.
I use this later for comparison purposes. I'm not the XPath guru so I essentially
store the end date as a String in the format YYYYMMDDHHMM and then exit the reporting loop when currentDateTime > v_endTimeString.

Wait 1 minute configured as follows -

The COB? (Close Of Business) condition for "Still within business hours" is set as follows -

xp20:format-dateTime(string(xp20:current-dateTime()), '[Y0001][M01][D01][H01][m01]') < bpmn:getDataObject('v_endTimeString')

Deploy and test

The output report should contain 5 entries for the time period 14:40 - 14:45.


Algis said...

Hi Niall,
I see that you are using "default flow" link notation e.g. "COB?-yes->End1".
Could you give me some advices, how should I interpret this "default" meaning? Because from BPMN standard there are advice to use it only for "ELSE" option.

Niall Commiskey said...

Hi Algis,

thanks for pointing this out. I've renamed the output flows accordingly and updated the screenshots.

Niall C.