You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by KevinC <fe...@hsbc.com.hk> on 2006/06/29 09:46:13 UTC

flow and correlation

BPEL 1.1 specification states that a flow completes when all of the
activities in the flow have completed.

So I try to use "flow" to receive two requests concurrently as follows:

<bpel:correlationSets>
	<bpel:correlationSet name="tradeIdentifier"
			     properties="tns:tradeCorr"/>
</bpel:correlationSets>
<bpel:sequence>
	<bpel:flow>
		<bpel:receive name="getPurchaserDataImpl" partnerLink="purchaserLT"
portType="tns:tradingPortType" operation="getPurchaserData"
variable="request1" createInstance="yes">
			<bpel:correlations>
				<bpel:correlation set="tradeIdentifier"
						  initiate="yes"/>
			</bpel:correlations>
		</bpel:receive>

		<bpel:receive name="getSellerDataImpl" partnerLink="sellerLT"
portType="tns:tradingPortType" operation="getSellerData" variable="request2"
createInstance="yes">
			<bpel:correlations>
				<bpel:correlation set="tradeIdentifier"
						  initiate="yes"/>
			</bpel:correlations>
		</bpel:receive>
	</bpel:flow>

	<bpel:assign>
	... <!-- copy values from above varaiables request1 & request2 -->
	</bpel:assign>
</bpel:sequence>

However when I feed in one requeset message only, the assignment code will
still be executed.
Is there any problem with the BPEL syntax? How can I wait for both requests
and correlate together before proceeding to the assignment part?
Thanks
-- 
View this message in context: http://www.nabble.com/flow-and-correlation-tf1866019.html#a5098445
Sent from the ServiceMix - User forum at Nabble.com.


Re: flow and correlation

Posted by KevinC <fe...@hsbc.com.hk>.
I'm using Servicemix ode bpe.

But I have encountered the problem that the "receive" cannot create two
instances when a second message with different correlation ID is sent.

ERROR - BaseLifeCycle$2.run(242) | Error processing exchange
org.apache.servicemix.jbi.messaging.InOnlyImpl@1cb374f
org.apache.ode.bpe.correlation.CorrelationServiceException: Error: Only one
receive with the same namespace, port type,
operation and correlation key can be active.  The following receive is
already active: namespace:urn:abc:prototype:
trading, port type:tradingPortType, operation:getSellerData, correlation
key:null.  The active receive must be fulfilled
 before another can be registered.
        at
org.apache.ode.bpe.action.bpel.RegisterAction.createRegistration(RegisterAction.java:260)
        at
org.apache.ode.bpe.action.bpel.RegisterAction.execute(RegisterAction.java:161)
        at
org.apache.ode.bpe.engine.ProcessInstance.executeActions(ProcessInstance.java:359)
        at
org.apache.ode.bpe.engine.ProcessInstance.evaluate(ProcessInstance.java:325)
        at
org.apache.ode.bpe.engine.ProcessInstance.evaluate(ProcessInstance.java:414)
        at
org.apache.ode.bpe.engine.ProcessInstance.processInternalEvent(ProcessInstance.java:254)
        at
org.apache.ode.bpe.engine.ProcessInstance.processEvent(ProcessInstance.java:209)
        at
org.apache.ode.bpe.correlation.CorrelationService.createInstanceAndRoute(CorrelationService.java:230)
        at
org.apache.ode.bpe.correlation.CorrelationService.correlateEvent(CorrelationService.java:337)
        at
org.apache.ode.bpe.bped.unmanaged.EventDirectorSLImpl.sendEvent(EventDirectorSLImpl.java:116)
        at
org.apache.servicemix.bpe.BPEEndpoint.process(BPEEndpoint.java:128)
        at
org.apache.servicemix.common.BaseLifeCycle.processExchange(BaseLifeCycle.java:374)
        at
org.apache.servicemix.common.BaseLifeCycle$2.run(BaseLifeCycle.java:240)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)

        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

And the BPEL flow is like this:

<bpel:flow>
<bpel:sequence>	
<bpel:receive name="getPurchaserDataImpl" partnerLink="purchaserLT"
	portType="tns:tradingPortType" operation="getPurchaserData"
variable="request1"
	createInstance="yes">
</bpel:receive>

<bpel:sequence>
	<bpel:flow>
	<bpel:receive name="getSellerDataImpl" partnerLink="sellerLT"
		portType="tns:tradingPortType" operation="getSellerData"
variable="request2"
		createInstance="no">
	<bpel:correlations>
	<bpel:correlation set="tradeID"	  initiate="yes"/>
	</bpel:correlations>
	</bpel:receive>
	
	<bpel:receive name="getBankDataImpl" partnerLink="bankLT"
		portType="tns:tradingPortType" operation="getBankData" variable="request3"
		createInstance="no">
	<bpel:correlations>
	<bpel:correlation set="tradeID"	  initiate="yes"/>
	</bpel:correlations>
	</bpel:receive>
	</bpel:flow>
	<!-- some assignments of variables -->
-- 
View this message in context: http://www.nabble.com/flow-and-correlation-tf1866019.html#a5145866
Sent from the ServiceMix - User forum at Nabble.com.


Re: flow and correlation

Posted by Alex Boisvert <bo...@intalio.com>.
Yes.    The BPEL 1.1 specification is explicit about it in section 11.4:

"Compliant implementations MUST ensure that only one of the inbound 
messages carrying the same correlation set tokens actually instantiates the
business process (usually the first one to arrive, but this is 
implementation dependent). The other incoming messages in the concurrent 
initial set MUST be delivered to the corresponding receive activities in 
the already created instance."

Which BPEL engine are you using?

alex

KevinC wrote:
> But the specification states that "It is permissible to have the
> createInstance attribute set to "yes" for a set of concurrent initial
> activities. In this case the intent is to express the possibility that any
> one of a set of required inbound messages can create the process instance
> because the order in which these messages arrive cannot be predicted. All
> such receive activities MUST use the same correlation sets." (P.55 of BPEL
> 1.1 specification)
>
> Doesn't it mean that only one instance will be created for receving the
> correlated messages even if I set both createInstance parameters to "yes" in
> the same flow?
>
> Thanks
>   


-- 
Intalio :: The Business Process Management Company  


Re: flow and correlation

Posted by KevinC <fe...@hsbc.com.hk>.
But the specification states that "It is permissible to have the
createInstance attribute set to "yes" for a set of concurrent initial
activities. In this case the intent is to express the possibility that any
one of a set of required inbound messages can create the process instance
because the order in which these messages arrive cannot be predicted. All
such receive activities MUST use the same correlation sets." (P.55 of BPEL
1.1 specification)

Doesn't it mean that only one instance will be created for receving the
correlated messages even if I set both createInstance parameters to "yes" in
the same flow?

Thanks
-- 
View this message in context: http://www.nabble.com/flow-and-correlation-tf1866019.html#a5113154
Sent from the ServiceMix - User forum at Nabble.com.


Re: flow and correlation

Posted by Guillaume Nodet <gn...@gmail.com>.
Not sure if this is related to your problem, but afaik, the createInstance
parameter
specifies that the bpel engine has to create a new process instance.  I ' m
not
a BPEL expert, but with such a script, I think you will not be able to
correlate the two
messages, as two processes will be created.

Cheers,
Guillaume Nodet

On 6/29/06, KevinC <fe...@hsbc.com.hk> wrote:
>
>
> BPEL 1.1 specification states that a flow completes when all of the
> activities in the flow have completed.
>
> So I try to use "flow" to receive two requests concurrently as follows:
>
> <bpel:correlationSets>
>         <bpel:correlationSet name="tradeIdentifier"
>                              properties="tns:tradeCorr"/>
> </bpel:correlationSets>
> <bpel:sequence>
>         <bpel:flow>
>                 <bpel:receive name="getPurchaserDataImpl"
> partnerLink="purchaserLT"
> portType="tns:tradingPortType" operation="getPurchaserData"
> variable="request1" createInstance="yes">
>                         <bpel:correlations>
>                                 <bpel:correlation set="tradeIdentifier"
>                                                   initiate="yes"/>
>                         </bpel:correlations>
>                 </bpel:receive>
>
>                 <bpel:receive name="getSellerDataImpl"
> partnerLink="sellerLT"
> portType="tns:tradingPortType" operation="getSellerData"
> variable="request2"
> createInstance="yes">
>                         <bpel:correlations>
>                                 <bpel:correlation set="tradeIdentifier"
>                                                   initiate="yes"/>
>                         </bpel:correlations>
>                 </bpel:receive>
>         </bpel:flow>
>
>         <bpel:assign>
>         ... <!-- copy values from above varaiables request1 & request2 -->
>         </bpel:assign>
> </bpel:sequence>
>
> However when I feed in one requeset message only, the assignment code will
> still be executed.
> Is there any problem with the BPEL syntax? How can I wait for both
> requests
> and correlate together before proceeding to the assignment part?
> Thanks
> --
> View this message in context:
> http://www.nabble.com/flow-and-correlation-tf1866019.html#a5098445
> Sent from the ServiceMix - User forum at Nabble.com.
>
>