< Previous | Next >

Creating the business process

The business state machine in this sample works in conjunction with a business process in order to achieve its goal.

This business process (which is invoked by the state machine) is responsible for: 1)
  1. checking if the third party is busy (to simplify the sample, the third party is never busy, and so the call should always connect),
  2. connecting the call to the third party and
  3. disconnecting the call from the third party.
  1. Create a new business process as follows:
    1. Right-click the BSM_Telco module and chose New > Business Process from the list.
    2. In the New Business Process wizard, name the business process TelcoConnectionService and click Next.
    3. On the Select an Interface page, click the Select an existing Interface radio button, and browse to the TelcoConnectionInterface.
    4. From the Operation list, select isBusy, and click Finish.
    A new business process is created, and appears in the editor as shown in this image:
    The business process as it first appears
  2. Delete the automatically generated Receive and Reply activities.
  3. From the second sub-palette, choose a Receive choice activity, and drop it onto the canvas. The activity will appear in the diagram with a single control path already defined.
    The business process as it first appears
  4. Configure the first control path:
    1. Rename the Receive element to isBusy.
    2. In the Details tab for the isBusy element, browse to the TelcoConnectionInterface for the partner, choose isBusy for the Operation, and select To as the input variable.
    3. Drop a snippet activity to the control path. In the Details tab, click the Java radio button, and paste the following text into the Java editor.
      java.lang.String __result__1 = "BPEL: " + To + " is not busy";
      {// print to log
      	System.out.println(__result__1);
      }
      boolean __result__3 = false;
      IsBusy = new java.lang.Boolean(__result__3);
    4. Drop a reply activity to the control path. In the Details tab, browse to the TelcoConnectionInterface , choose isBusy for the Operation, and select IsBusy as the output variable.
    The first complete control path
  5. Create a second control path:
    1. Click and hover over the ReceiveChoice activity to launch the action menu.
    2. Chose the Add Receive icon. Another control path appears in the parent receive choice activity.
    3. Rename the Receive element to connect.
    4. In the Details tab for the connect element, browse to the TelcoConnectionInterface for the partner, choose connect for the Operation, and select From as the first input variable, and To as the second.
    5. Drop a snippet activity to the control path with the following text:
      java.lang.String __result__1 = "BPEL: Connect call from ";
      java.lang.String __result__3;
      {// append text
      	__result__3 = __result__1.concat(From);
      }
      java.lang.String __result__4 = " to ";
      java.lang.String __result__5;
      {// append text
      	__result__5 = __result__3.concat(__result__4);
      }
      java.lang.String __result__7;
      {// append text
      	__result__7 = __result__5.concat(To);
      }
      {// print to log
      	System.out.println(__result__7);
      }
      boolean __result__9 = true;
      Ok = new java.lang.Boolean(__result__9);
    6. Drop a reply activity to the control path. In the Details tab, browse to the TelcoConnectionInterface , choose connect for the Operation, and select Ok as the output variable.
  6. Create a third control path:
    1. Add another Add Receive element and name it disconnect
    2. In the Details tab for the disconnect element, browse to the TelcoConnectionInterface for the partner, choose disconnect for the Operation, and select From as the first input variable, and To as the second.
    3. Drop a snippet activity to the control path with the following text:
      java.lang.String __result__1 = "BPEL: Disconnect call from ";
      java.lang.String __result__3;
      {// append text
      	__result__3 = __result__1.concat(From);
      }
      java.lang.String __result__4 = " to: ";
      java.lang.String __result__5;
      {// append text
      	__result__5 = __result__3.concat(__result__4);
      }
      java.lang.String __result__7;
      {// append text
      	__result__7 = __result__5.concat(To);
      }
      {// print to log
      	System.out.println(__result__7);
      }
      boolean __result__9 = true;
      Ok = new java.lang.Boolean(__result__9);
    4. Drop a reply activity to the control path. In the Details tab, browse to the TelcoConnectionInterface , choose disconnect for the Operation, and select Ok as the output variable.
When you are finished, the final process should look like the one in this image:
The completed process.

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.
< Previous | Next >