ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

What Is Business Process Modeling
Pages: 1, 2, 3, 4

These diagrams were drawn with ITpearls' Process Modeler, which is a set of BPMN stencils for Microsoft Visio. Process Modeler is not a full-fledged process development tool, but merely a drawing application. It cannot, for example, generate BPEL code; this step, too, is manual. Regardless, the diagrams are valuable for design documentation; just as a UML drawing tool that cannot generate actual Java or C# code can still help software architects document the objects and components of an application, so Process Modeler helps business analysts or architects render process flows in a standard process representation.



As it turns out, the mapping to BPEL is straightforward: the "events" of the BPMN process (e.g., "Wait Warehouse Response") are BPEL "receive" activities (or activities that wait for events to occur); the "activities" (e.g., "Send PO to Warehouse") are BPEL "invoke" activities (or activities that call services); the conditional structure enclosing "Sales Followup" is a BPEL "switch" activity; and the entire flow is a "sequence" activity. The BPEL code, each of whose eight steps derived from BPMN is indicated by a comment (e.g., line 12 indicates step 1), is provided in Example 2.

Example 2. Retailer BPEL code


1	<process name="Retailer" 
2	   targetNamespace="http://acm.org/samples" suppressJoinFailure="yes"
3	   xmlns:tns="http://acm.org/samples" 
4	   xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
5	   xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/
          business-process/">
6	
7	   <!-- some code omitted - ->
8	
9	   <!-- Mainline process code starts here -->
10	   <sequence name="main">
11	
12	      <!-- Step 1: Consumer sends PO -->
13	      <receive name="receiveInput" partnerLink="consumer" 
                portType="tns:Retailer" 
14	         createInstance="yes" operation="sendPO" variable="po">
15	         <!-- Use the inbound PO message as the basis for 
                     correlation -->
16	         <correlations>
17	            <correlation set="poset" initiate="yes"/>
18	         </correlations>
19	      </receive>
20	
21	      <!-- Step 2: Send receipt ack to consumer -->			
22	      <invoke name="callbackClient" partnerLink="consumer" 
23	         portType="tns:RetailerCallback"  operation="poReceipt" 
24	         inputVariable="po"/>
25	
26	      <!-- Step 3: create PO record in internal database -->
27	      <invoke name="writePOToDB" partnerLink="retailerDB" 
                portType="tns:RetailerDB" 
28	         operation="createPO" inputVariable="po"/>
29	
30	      <!-- Step 4: send PO to warehouse -->
31	      <invoke name="sendPOToWH" partnerLink="warehouse" 
                portType="tns:Warehouse" 
32	         operation="sendPO" inputVariable="po"/>
33	
34	      <!-- Step 5: wait for warehouse response -->
35	      <receive createInstance="no" name="receiveWHResponse" 
                partnerLink="warehouse" 
36	         portType="tns:WarehouseCallback" operation="onResult" 
37	         variable="poResponse">
38	         <!-- correlate on identifiers in initial PO -->
39	         <correlations>
40	            <correlation set="poset" initiate="no"/>
41	         </correlations>			
42	      </receive>
43	
44	      <!-- Step 6: send warehouse response to consumer -->
45	      <invoke name="responseToConsumer" partnerLink="consumer" 
46	         portType="tns:RetailerCallback"
47	         operation="poResult" inputVariable="poResponse"/>
48	
49	      <!-- Step 7: update PO in internal database -->
50	      <invoke name="updateDB" partnerLink="retailerDB" 
                portType="tns:RetailerDB" 
51	         operation="updatePO" inputVariable="poResponse"/>
52	
53	      <!-- Step 8: Special processing if warehouse rejected PO -->
54	      <switch name="checkResp">
55	         <!-- It's a reject if the "action" field of the 
56	              warehouse response is "reject" -->
57	         <case condition="bpws:getVariableData(
58	            "poResponse","payload",
59	            "/tns:POMsg/tns:action") = "reject"">
60	            <sequence>
61	               <!-- Assign a task to a sales rep to 
                        contact the consumer about the
62	                    rejection. Fire and forget: don't 
                        bother waiting for the result 
63	                    of the task. -->
64	               <invoke name="salesFollowup" partnerLink="taskMgr" 
65	                  portType="tns:WorkflowTaskManager"
66	                  operation="create" inputVariable="task"/>
67	            </sequence>
68	         </case>
69	         <otherwise/>
70	      </switch>
71	   </sequence>
72	</process>

In the BPEL code, "partner links" (marked by the partnerLink XML attribute, such as partnerLink="consumer" in line 13) are used to identify the parties with which the process converses. Four partner links are used:

  • consumer, representing the consumer process, is used in steps 1, 2, and 6.
  • warehouse, representing the warehouse process, is used in steps 4 and 5.
  • retailerDB, a web service interface to the retailer's internal database, is used in steps 3 and 7.
  • taskMsg, a web service interface to human workflow, is used in step 8.

All three types of process interactions are represented: consumer and warehouse are external system interactions, retailerDB an internal system interaction, and taskMgr human interaction. All interactions are web-service-based. Each partner has a WSDL that describes its interface. Interestingly, the retailer process itself is a web service; its "receive" activities are web service operations, which are documented in a WSDL that the process published to its partners.

Unlike BPMN and WS-CDL, BPEL has an abundance of good tools, such as Oracle's BPEL Process Manager, which is put to use in the development of two substantial BPEL examples in Essential Business Process Modeling. Oracle's platform can be used to test the retailer process.

Conclusion

The realization of those sketchy flowcharts drawn by business analysts on whiteboards requires an architecture built on the best of BPM's many standards: BPEL, BPMN, and WS-CDL. Alas, no actual vendor implementation of this architecture exists today, but, as our retailer process example shows, a useful approximation can be fashioned.

Michael Havey is an architect of several major BPM applications and author of magazine articles on BPM and process-oriented applications.


View catalog information for Essential Business Process Modeling

Return to ONJava.com.