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 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:

    image

    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 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 the X in the top right-hand corner of the node builder.
  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) 
    

    image

  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:

    image

  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, select String in the list of Java Types. The Variable type field is populated with java.lang.String.
  17. Click OK. The stopQuote variable is created and is displayed in the Receive Data tab (and on the Data Palette Variables tab).
  18. image

    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 the X in the top right-hand corner.
  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 image Client Response in the 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. image

  4. Change the name of the node from Client Response to Deny Quote.
  5. Double-click the Deny Quote node to open its node builder.
  6. In the General Settings tab, change the default name in the Method Name field to denyQuote.
  7. Click Add to display the panel of data types.
  8. 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.

  9. Select Java on the panel of data types, then in the list of Java Types, select String. The Type field is populated with java.lang.String.
  10. In the Name field, replace the default x0 by entering stopQuote and click OK.
  11. 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.
  12. The Client Expects field is populated with the data type and parameter name you specified on the General Settings tab: String stopQuote.

  13. Under Select variables to assign, select stopQuote (String).
  14. image

  15. To close the Client Response node builder, click the X in the top right-hand corner.
  16. 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 image to image indicating that the design of the node is complete.

  17. From the Workshop menu, select File —> Save.

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 WebLogic Workshop, select View —> Property Editor from the menu bar.

    image

  3. Verify the following properties for the OnMessage path:

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:
Handling Exceptions
Adding Message Paths
Adding Timeout Paths

Previous Document Next Document