I have a scope/CompensationHandler inside a (non parallel) foreach.
When I try to compensate after several successful iterations the results
are very inconsistent. Sometimes the compensation handlers run.
Sometimes they don't.
Here's my test process. The input is ignored. The process iterates 5
times and then generates a fault to trigger the compensation. The
compensation handler just concats the foreach counter value to the
output. I would expect the output to be "5 4 3 2 1" but it's not. It
seems to return something different each time: "5 4 2 1", "5 4 2", "5 3
2 1". It gets even worse when I run the process "in memory": "4", "4
2", "5", "3", etc.
This must be a bug in Ode, right? I'm using Ode 1.3.2.
<?xml version="1.0" encoding="UTF-8"?>
<bpel:process exitOnStandardFault="yes"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
name="CompensationTest1"
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
suppressJoinFailure="no"
targetNamespace="test:test:CompensationTest1"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:ode="http://www.apache.org/ode/type/extension"
xmlns:tns="test:test:CompensationTest1"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<bpel:import importType="http://schemas.xmlsoap.org/wsdl/"
location="CompensationTest1.wsdl"
namespace="test:test:CompensationTest1"/>
<bpel:partnerLinks>
<bpel:partnerLink myRole="ServiceProvider" name="client"
partnerLinkType="tns:ServicePartnerLinkType"/>
</bpel:partnerLinks>
<bpel:variables>
<bpel:variable messageType="tns:InputMessage" name="input"/>
<bpel:variable messageType="tns:OutputMessage" name="output"/>
</bpel:variables>
<bpel:sequence name="process">
<bpel:receive createInstance="yes" name="ReceiveInput"
operation="process" partnerLink="client"
portType="tns:ServicePortType" variable="input"/>
<bpel:assign name="InitializeOutput" validate="no">
<bpel:copy>
<bpel:from
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C
DATA[""]]></bpel:from>
<bpel:to part="payload" variable="output"/>
</bpel:copy>
</bpel:assign>
<bpel:scope name="Scope">
<bpel:faultHandlers>
<bpel:catch faultName="tns:DummyFault">
<bpel:sequence>
<bpel:compensate name="Compensate"/>
</bpel:sequence>
</bpel:catch>
</bpel:faultHandlers>
<bpel:sequence name="Sequence">
<bpel:forEach counterName="Counter" name="ForEach"
parallel="no">
<bpel:startCounterValue
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C
DATA[1]]></bpel:startCounterValue>
<bpel:finalCounterValue
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C
DATA[5]]></bpel:finalCounterValue>
<bpel:scope name="IterateScope">
<bpel:compensationHandler>
<bpel:sequence>
<bpel:assign name="Assign"
validate="no">
<bpel:copy>
<bpel:from
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C
DATA[concat($output.payload, " ", $Counter)]]></bpel:from>
<bpel:to part="payload"
variable="output"/>
</bpel:copy>
</bpel:assign>
</bpel:sequence>
</bpel:compensationHandler>
<bpel:empty name="DoSomething5Times"/>
</bpel:scope>
</bpel:forEach>
<bpel:throw faultName="tns:DummyFault" name="Throw"/>
</bpel:sequence>
</bpel:scope>
<bpel:reply name="ReplyWithOutput" operation="process"
partnerLink="client" portType="tns:ServicePortType"
variable="output"/>
</bpel:sequence>
</bpel:process>