Tutorial: Building Your First Business Process

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Step 14: Designing a Message Path for Your Business Process

In this step, you create a message path on your business process that specifies the logic to handle a callback from the channel to which the ValidateOrder service posts a message.

In this case, you associate the Message path you create with the Start node in your business process. It is also possible to associate Message paths with individual nodes or groups of nodes. For the case in which a Message path is associated with the Start node, the logic defined within the path applies to the entire business process in the event a message is received on this path. (The same is true for Exception paths and Timeout paths created on business process Start nodes.) The logic defined for paths associated with individual nodes or groups of nodes applies to those individual or groups of nodes. To learn more about Message, Exception, and Timeout paths for business processes, see Related Topics.

This step includes the following tasks:

To Create a Message Path on Your Business Process That Handles Messages Routed via a Channel to Which Your Process is Subscribed

In this step, you learn how to create a message path on your business process that handles the following tasks:

Message paths can be associated with individual nodes or groups of nodes that contain a blocking element, or with the business process (global). In this case, you design a global message path for the business process by specifying the message path at the Start node.

To Design a Node to Receive the Message Event From the StopQuote Channel
  1. Ensure that the RequestQuote business process is displayed in the Design view.
  2. Right-click the Request Quote node (start node), then choose Add Message Path from the drop-down menu.
  3. A path, which contains a placeholder for the event that invokes the path at run time, is created to the right of the Start node in the Design View:



    Note: The Message Broker Subscription control you created in Step 13 does not define callback methods for you. You design a Control Receive node on this message path to define a custom callback that specifies how the business process expects to receive the event messages from the StopQuote channel to which it is subscribed.
  4. Double-click the Double Click to Select Start Event (Starting Event) node on the message path to display the types of nodes you can choose for this path.
  5. Choose A Control Receive, then click Close.
  6. A Control Receive node is added to the OnMessage path. This node specifies that this path waits to receive a message from a control.

  7. On the Data Palette, click the following method in the mbSubValidate control:
  8. void onMessage(String message)



  9. Drag and drop the method onto the message path (OnMessage), placing it on the Control Receive node.
  10. The Control Receive node in the OnMessage path changes to reflect the binding of the Subscription control method: the node is named onMessage and the Start node icon reflects a Message Broker Subscription control. Your message path should resemble that displayed in the following figure:



  11. Double-click the onMessage node. The node builder opens on the General Settings tab. The mbSubValidate control and its void onMessage (String message) method are already selected.
  12. Click Receive Data to open the second tab in the node builder, in which you can assign a variable to which the message that is received from the StopQuote channel is stored.
  13. The Control Returns field is populated with the data type and the name of the parameter expected by the control: String message.

  14. In the Select variables to assign field, click the arrow to display the variables in your project, then select Create new variable.... The Create Variable dialog box is displayed.
  15. In the Variable Name field, enter stopQuote.
  16. In the Select Variable Type pane, click Simple tab, expand Classes, and select String. The value java.lang.String is populated in the Type Name field.
  17. Click OK. The stopQuote variable is created and is displayed in the Receive Data tab (and on the Data Palette Variables tab).


  18. This completes the assignment of the message from the StopQuote Message Broker channel to the stopQuote variable.

  19. To close the onMessage node builder, click Close.
  20. This step completes the design of the callback handler that handles a message event on the StopQuote channel to which your RequestQuote business process is subscribed.

To Design a Node to Send a Message to Clients in the Event the Business Process Receives a StopQuote Message From the StopQuote Channel
  1. Ensure that your RequestQuote business process open in the Design view.
  2. Click Client Response in the Node Palette, then drag and drop the node onto the business process, placing it on the message path, immediately after the onMessage subscription node. The Design view is updated to contain the Client Response node.


  3. Change the name of the node from Client Response to Deny Quote.
  4. Double-click the Deny Quote node to open its node builder.
  5. In the General Settings tab, change the default name in the Method Name field to denyQuote.
  6. Click Add to display the panel of data types.
  7. Note: In a preceding step, you created a variable of type String to hold the message received from the ValidateOrder service, via the StopQuote channel. This is the message your RequestQuote business process sends to clients in the event that the Request for Quote is invalid. Therefore we are concerned with String Java Types at this node.
  8. Select Simple on the panel of data types, then, select String. The Type field is populated with java.lang.String.
  9. In the Name field, replace the default x0 by entering stopQuote and click OK.
  10. Click the Send Data tab to open the tab that allows you to assign the variable that holds the data your business process sends to clients.
  11. The Client Expects field is populated with the data type and parameter name you specified on the General Settings tab: String stopQuote.

  12. Under Select variables to assign, select stopQuote (String).


  13. To close the Client Response node builder, click Close.
  14. In the Design view, note that by completing the tasks in the node builder, the completeness icon associated with the Send Quote node changed from to indicating that the design of the node is complete.

  15. From the Workshop menu, select FileArrow symbolSave.
To Specify the Behavior of Your Business Process in the Event that the Message Path is Triggered

In this step you learn how to specify the run-time behavior of your business process in the event this message path is triggered. To do so, you use the Property Editor to set the after execute property for your message path.

  1. In Design view, click the OnMessage path icon. The Property Editor displays properties for the OnMessage path.
  2. Note: If the Property Editor is not visible in BEA Workshop, select WindowsArrow symbol Show ViewArrow symbolProperties from the menu bar.



  3. Verify the following properties for the OnMessage path:
    • name—Displays the name of the message path: OnMessage. Click on this property if you want to enter a new name for the path.
    • notes—You can click ... in the notes field to invoke a text editor in which you can add text. For example, you can use it to document something about this node.
    • after execute—Specifies the behavior of the business process when this message node is activated at run time. skip is specified by default.
    • Valid options for this property include skip and resume, described here for heuristic purposes. In our scenario, you should not change the default specification.

      skip—Specifies that after execution of the message path, the process engine skips the node or group with which the message path is associated. That is, the process engine resumes execution of the process at the node following the node or group for which the message path is defined. In the special case of a global message path—one defined for the business process on the Start node—the process is terminated after execution of the message path.

      resume—Specifies that after execution of the message path, the process engine resumes execution of the business process at the node that was executing when the message was received. That is, the process state returns to what it was before the message path executed and the On Message port is still active.

    • retry count—Specifies how many times the process engine retries to execute the nodes contained in the Message path after the first attempt to execute them and before the after execute path is taken. Zero is specified by default.

This step completes the design of the message path on your RequestQuote business process.

By completing this section, you created the logic that allows your RequestQuote business process to publish the Request for Quote message it receives from clients to a Message Broker channel. (A validation service is subscribed to that channel). You also created a dynamic subscription to another Message Broker channel to allow your RequestQuote business process to receive messages published by the validation service.

To run the business process you created by following the steps in Part IV of this tutorial, proceed to Step 15: Run and Test the Request Quote Business Process With the Quote Validation Service.

Related Topics

To learn about designing Message paths, Exception paths, and Timeout paths for your business process, see the following topics in the Guide to Building Business Processes:


  Back to Top       Previous  Next