Here is my note for meeting the CDL Challenge regarding business protocol race-conditions

  Order Fulfillment Collaboration use-case coded using WS-CDL

                            Nickolaos Kavantzas
                         Web Services Architect
                                     Oracle
                             October 10, 2004


The use-case described here demonstrates an end-to-end business process
that's concerned with handling orders between a really big corporation (RBC)
and an outside supplier, STC, which manufactures and distributes
t-shirts. RBC and STC are engaged together in the 'Order Fulfillment' Collaboration
in order to achieve their common business goal.

For this to work successfully, RBC must provide the business protocol rules
under which it's willing to engage in an electronic business with suppliers
such as STC:

1. RBC starts the procurement of t-shirts by creating an order with STC.

2. STC acknowledges the purchase order. This initiates a business
   process in STC that handles the PO. For all RBC knows, STC has an employee
   at a computer handling the PO, or a sophisticated Process Management System
   that's linked with back-end manufacturing, logistics, and procurement systems

3. After the internal processes within STC regarding the PO are
   completed, which may take days or even months, STC sends a Purchase Order
   Completed message back to RBC in order for RBC to complete its own business
   process

4. RBC can send a Cancel Order message to abort STC's business process,
   any time before RBC receives the Purchase Order Completed message from STC

5. If the Cancel Order message arrives at STC before the Purchase
   Order Completed message is sent from STC, then STC aborts its business process
   and acknowledges this to RBC with the Purchase Order Cancelled message in order
   for RBC to abort its own business process too. Otherwise, if STC has already
   sent the Purchase Order Completed message, it ignores the Cancel Order message
   because RBC has agreed that it will honor POs when cancellations are not sent
   out within an agreed-upon timeframe

7. If RBC has already sent the Cancel Order message and then it receives the
   Purchase Order Completed message, then instead of aborting its own
   business process it rather completes it






The following WS-CDL snippet codes the use-case described above,
including the possible race-condition between the Cancel Order and the
Completed Order messages:



<package name="Oracle, Nickolaos Kavantzas--Order Fulfillment Business Protocol--october-10-2004">


<roleType name="B">
   <behavior name="B-behav1" interface="B-Intf" />
</roleType>

<roleType name="S">
   <behavior name="S-behav1" interface="S-Intf" />
</roleType>

<relationshipType name="rel">
   <role type="B" />
   <role type="S" />
</relationshipType>


<choreography name="Order Fulfillment"
              complete="cdl:getVariable(PO-State) == Cancelled) OR
                        cdl:getVariable(PO-State) == Completed )" >
  <relationship name="rel">

  <variableDefinitions>
     <variable  name="PO-State" />
     <variable  name="B-Internal-State" roleType="B" silentAction="true" />
     <variable  name="S-Internal-State" roleType="S" silentAction="true" />
  </variableDefinitions>

  <seq>
     <ixn oper="createOrder">
        <participate relationship="rel" fromRole="B" toRole="S"/>

        <exchange action="request" >
           <send    recordRef="rec"/>
           <receive recordRef="rec"/>
        </exchange>

        <record name="rec" when="after">
           <source  var="ActivePending"/>
           <target  var="cdl:getVariable(PO-State)"/>
        </record>
     </ixn>

     <ixn oper="placedOrder">
        <participate relationship="rel" fromRole="S" toRole="B"/>
        <exchange action="request" >
           <send    recordRef="rec"/>
           <receive recordRef="rec"/>
        </exchange>

        <record name="rec" when="after">
           <source  var="Active"/>
           <target  var="cdl:getVariable(PO-State)"/>
        </record>
     </ixn>


     <parallel>

        <workunit name="do-cancel"
             guard="cdl:globalizedTrigger(
                           "cdl:isVariableAvailable(B-Internal-State) AND
                            cdl:getVariable(PO-State, "B") == Active" , "B",
                           "cdl:getVariable(PO-State, "S") == Active" , "S")"
             block="true" >

           <sequence>
              <ixn oper="cancelOrder">
                 <participate relationship="rel" fromRole="B" toRole="S"/>
                 <exchange action="request" >
                     <send    recordRef="rec"/>
                     <receive recordRef="rec"/>
                 </exchange>

                 <record name="rec" when="after">
                     <source  var="Canceling"/>
                     <target  var="cdl:getVariable(PO-State)"/>
                 </record>
              </ixn>

              <workunit name="do-cancelled"
                 guard="cdl:globalizedTrigger(
                           "cdl:getVariable(PO-State, "B") == Canceling", "B",
                           "cdl:getVariable(PO-State, "S") == Canceling", "S")"
                 block="true" >

                 <ixn oper="cancelledOrder">
                    <participate relationship="rel" fromRole="S" toRole="B"/>
                    <exchange action="request" >
                       <send    recordRef="rec"/>
                       <receive recordRef="rec"/>
                    </exchange>

                    <record name="rec" when="after">
                       <source  var="Cancelled"/>
                       <target  var="cdl:getVariable(PO-State)"/>
                    </record>
                  </ixn>
               </workunit>
           <sequence>
        </workunit>

        <workunit name="do-complete"
             guard="cdl:globalizedTrigger(
                           "cdl:getVariable(PO-State, "B") == Active OR
                            cdl:getVariable(PO-State, "B") == Canceling", "B",
                           "cdl:isVariableAvailable(S-Internal-State) AND
                            cdl:getVariable(PO-State, "S") == Active"   , "S")"
             block="true" >

              <ixn oper="completedOrder">
                 <participate relationship="rel" fromRole="S" toRole="B"/>
                 <exchange action="request" >
                     <send    recordRef="rec"/>
                     <receive recordRef="rec"/>
                 </exchange>

                 <record name="rec" when="after">
                     <source  var="Completed"/>
                     <target  var="cdl:getVariable(PO-State)"/>
                 </record>
              </ixn>

        </workunit>

     </parallel>

  </seq>

</choreography>

</package>








---------------------------------------------------------------------------------------------------
Steve Ross-Talbot wrote:

> Nick has signed up to meeting the CDL challenge at the F2F and JJ said
> he would also provide a solution.
>
> I re-issue the challenge below as it was originally sent out and I look
> fwd to two examples that shows how it can be done.
>
> Best regards
>
> Steve T
>
> Begin forwarded message:
>
> > Resent-From: public-ws-chor@w3.org
> > From: Steve Ross-Talbot <steve@enigmatec.net>
> > Date: 23 June 2004 15:07:39 BST
> > To: WS-Choreography List <public-ws-chor@w3.org>
> > Subject: CDL Challenge
> >
> > Members and interested parties,
> >
> > Nick sent a set of slides sometime ago all about CDL. They were ones
> > he had used with Oracle for external outreach activities. I enclose
> > one of those slides here.
> >
> > The challenge is to code up the slide in WS-CDL taking account of any
> > state alignment necessary. What is not required is the full blown
> > WS-CDL but what is required is the choreography definitions to support
> > the slides.
> >
> > I look forward to hearing from any of you who manages to do this and
> > share it with the group on this list.
> >
> > Cheers
> >
> > Steve T
> >
>
>                                                   -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>                    Name: slide27.tiff
>    slide27.tiff    Type: TIFF Image (image/tiff)
>                Encoding: base64

Received on Monday, 11 October 2004 18:00:42 UTC