You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Jonathan Coogan <Jo...@Attachmate.com> on 2009/10/21 20:21:47 UTC

CompsensationHandler inside a sequential ForEach

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>


Re: CompsensationHandler inside a sequential ForEach

Posted by Jonathan Coogan <Jo...@attachmate.com>.
I just tried my test again with a 1.X build (running the .war distribution
in Tomcat) and it still does not work for me.  I am still seeing different
output every time I run my process.

-Jon




On 10/22/09 3:48 PM, "Rafal Rusin" <ra...@gmail.com> wrote:

> I added your test case and it works fine on latest 1.X snapshot
> (hibernate and openjpa configs).
> You can check out branch
> http://github.com/rafalrusin/apache-ode/tree/APACHE_ODE_1.X-compensation-handl
> ers
> enter jbi dir and type
> buildr _1.2.10_ clean test:CompensationHandlersJbiTest
> 
> If you feel it should fail, just try to mess up with
> jbi/src/test/resources/CompensationHandlersJbiTest/ directory.
> 
> 2009/10/21 Jonathan Coogan <Jo...@attachmate.com>:
>> 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>
>> 
>> 
> 
> 
> Regards,


Re: CompsensationHandler inside a sequential ForEach

Posted by Jonathan Coogan <Jo...@attachmate.com>.
Thank you, Rafal.


On 10/22/09 3:48 PM, "Rafal Rusin" <ra...@gmail.com> wrote:

> I added your test case and it works fine on latest 1.X snapshot
> (hibernate and openjpa configs).
> You can check out branch
> http://github.com/rafalrusin/apache-ode/tree/APACHE_ODE_1.X-compensation-handl
> ers
> enter jbi dir and type
> buildr _1.2.10_ clean test:CompensationHandlersJbiTest
> 
> If you feel it should fail, just try to mess up with
> jbi/src/test/resources/CompensationHandlersJbiTest/ directory.
> 
> 2009/10/21 Jonathan Coogan <Jo...@attachmate.com>:
>> 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>
>> 
>> 
> 
> 
> Regards,


Re: CompsensationHandler inside a sequential ForEach

Posted by Rafal Rusin <ra...@gmail.com>.
I added your test case and it works fine on latest 1.X snapshot
(hibernate and openjpa configs).
You can check out branch
http://github.com/rafalrusin/apache-ode/tree/APACHE_ODE_1.X-compensation-handlers
enter jbi dir and type
buildr _1.2.10_ clean test:CompensationHandlersJbiTest

If you feel it should fail, just try to mess up with
jbi/src/test/resources/CompensationHandlersJbiTest/ directory.

2009/10/21 Jonathan Coogan <Jo...@attachmate.com>:
> 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>
>
>


Regards,
-- 
Rafał Rusin
http://www.touk.pl
http://top.touk.pl
http://people.apache.org/~rr/