BPEL, initialize variable and repeating onAlarm eventHandler

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2012-08-08T09:40:34Z Indexed on 2012/09/12 15:38 UTC
Read the original article Hit count: 290

Filed under:
|

I have a little problem I can't solve so far. In BPEL I want to create an onAlarm eventHandler which fires immediatly (i.e. the "for" element is set to 'PT0S') and repeats every 2 seconds. This eventHandler shall contain a counter which increments every time the alarm fires.

The question is: How to initialize the counter? If the variable will be initialized within the onAlarm scope the value would not increment anymore. In the "normal" control flow the value also cannot be initialized, because it is not defined if the process or the onAlarm scope runs first. So I would get every now and then an uninitializedVariable exception.

My solution would be to not initialize the variable neither in the process scope nor in the onAlarm scope, but create a faultHandler wherein the variable will be initialized and afterwards the onAlarm flow will be executed. Problem is every uninitializedVariable execution will be caught now by this faultHandler and there may be another too.

So is there another possibility to deal with this problem or can I somehow find out which variable wasn't initialized properly so the faultHandler can get two control flows?

The solution should work on every BPEL engine.

Thanks, Michael

© Stack Overflow or respective owner

Related posts about initialization

Related posts about bpel