Hello,
I am using the JBI distribution of ODE 1.1-SNAPSHOT (July 31) with
Servicemix 3.1.1 and have a problem with an event handler in the local
scope inside the main sequence.
My event handler uses correlation set that is initialized in an <invoke>
activity after the process has already been instantiated so it cannot
belong to the global process scope. The process structure can be roughly
described as the following:
1. receive message and instantiate process
2. make a call to a web service and initialize the correlation set
3. enter the local scope with several event handlers that use that
correlation set.
3.a. the scope activity sequence contains <receive> activity that
waits for a message, so my event handlers will be active until a special
message is received
4. end process
Q1: Is it a correct process structure to get the behavior described in 3.a.?
I have created a sample process based on the HelloWorld2 example but my
event handlers do not work.
My sample process is slightly simpler than I described above (it
initializes correlation set in the main <receive> activity instead of
<invoke> and uses <wait> activity to define the scope lifetime instead
of waiting for a message)
In the log I often see messages like the following:
21:48:29,323 | DEBUG | pool-2-thread-1 | BpelProcess |
.engine.BpelRuntimeContextImpl 196 | ProcessImpl completed with fault
'{http://schemas.xmlsoap.org/ws/2004/03/business-process/}conflictingReceive'
and
21:48:29,323 | WARN | btpool0-2 | jetty |
ervicemix.http.jetty.JCLLogger 93 | /Callback/
java.lang.Exception:
org.apache.ode.jbi.msgmap.MessageTranslationException: Unmapped Fault :
{http://schemas.xmlsoap.org/ws/2004/03/business-process/}conflictingReceive:
null
... but sometimes my event handler works. For example I've got the
following results for a test run using SoapUI:
1. send a message to instantiate process passing it some correlation value
2. send a callback with the previous value - OK - got the response (but
sometimes I've got the conflictingReceive fault here)
3. send another callback message to this process instance and failed to
get a response
4. instantiate another process instance with different correlation value
5. send callback to the second instance - FAIL with conflictingReceive fault
Q2. Is it a correct behavior? I thought that an event handler in a
process instance can handle as many messages as it can until it's scope
become inactive.
Thanks
Alexander
PS: my sample bpel process is attached
<?xml version="1.0"?>
<process name="HelloWorld2"
targetNamespace="urn:/HelloWorld2.bpel"
xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
xmlns:tns="urn:/HelloWorld2.bpel"
xmlns:hello="urn:/HelloWorld2.wsdl"
xmlns:cll="urn:/Callback2.wsdl"
xmlns:hellocorr="urn:/HelloWorld2.wsdl/correlation"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import location="HelloWorld2.wsdl"
namespace="urn:/HelloWorld2.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/" />
<import location="Callback.wsdl"
namespace="urn:/Callback2.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/" />
<import location="HelloWorld2Correlation.wsdl"
namespace="urn:/HelloWorld2.wsdl/correlation"
importType="http://schemas.xmlsoap.org/wsdl/" />
<partnerLinks>
<partnerLink name="helloPartnerLink"
partnerLinkType="hello:HelloPartnerLinkType"
myRole="Provider" />
</partnerLinks>
<correlationSets>
<correlationSet name="HelloCorrelator" properties="hellocorr:helloId" />
</correlationSets>
<variables>
<variable name="request" messageType="hello:HelloRequest"/>
<variable name="response" messageType="hello:HelloResponse"/>
</variables>
<sequence>
<receive
name="start"
partnerLink="helloPartnerLink"
portType="hello:HelloPortType"
operation="Hello"
variable="request"
createInstance="yes">
<correlations>
<!--
in my production system the correlation set is actually initialized
in some <invoke> activity when the instance of the process is already running
-->
<correlation set="HelloCorrelator" initiate="yes"/>
</correlations>
</receive>
<assign name="assign1">
<copy>
<from>
<literal>
<hello:HelloResponse>
<hello:text>quux</hello:text>
</hello:HelloResponse>
</literal>
</from>
<to>$response.body</to>
</copy>
</assign>
<reply name="end"
partnerLink="helloPartnerLink"
portType="hello:HelloPortType"
operation="Hello"
variable="response"/>
<scope>
<variables>
<variable name="callbackRequest" messageType="cll:CallbackRequest"/>
<variable name="callbackResponse" messageType="cll:CallbackResponse"/>
</variables>
<partnerLinks>
<partnerLink name="callbackPartnerLink"
partnerLinkType="cll:CallbackPartnerLinkType"
myRole="Provider" />
</partnerLinks>
<eventHandlers>
<onEvent
name="receive callback request"
partnerLink="callbackPartnerLink"
operation="Callback"
portType="cll:CallbackPortType"
variable="callbackRequest"
messageType="cll:CallbackRequest"
messageExchange="quuxCallback"
createInstance="no">
<correlations>
<correlation set="HelloCorrelator" initiate="no"/>
</correlations>
<scope>
<sequence>
<assign name="assign2">
<copy>
<from>
<literal>
<cll:CallbackResponse>
<cll:callback>callback works!</cll:callback>
</cll:CallbackResponse>
</literal>
</from>
<to>$callbackResponse.body</to>
</copy>
</assign>
<reply name="end"
partnerLink="callbackPartnerLink"
portType="cll:CallbackPortType"
operation="Callback"
variable="callbackResponse"
messageExchange="quuxCallback"/>
</sequence>
</scope>
</onEvent>
</eventHandlers>
<sequence>
<wait>
<!-- wait some time to ensure that event handler is active -->
<for>'PT100S'</for>
</wait>
</sequence>
</scope>
</sequence>
</process>