To design the Message Broker functionality described in Understanding the Validation Service Scenario, you create nodes in your RequestQuote business process: one that publishes to the ValidateOrder Message Broker channel and one that subscribes to the StopQuote Message Broker channel. Subsequently, you create a message path on your business process. On the message path, you create the logic to handle the callback from the channel (StopQuote) to which the ValidateOrder service posts a message. That logic specifies that the RequestQuote business process terminates after it receives a callback from the channel to which it is subscribed.
This step includes the following tasks:
You must first create a Message Broker Publish control in your project, then bind a method from the control to a node in your business process. To do so, complete the following steps:
/TutorialPrefix/Tutorial/ValidateOrder
/TutorialPrefix/Tutorial/StopQuote
Note: | The following channels are also available: /deadletter/xml, /deadletter/string, /deadletter/rawData, /WorklistEvent. To learn about using dead letter channels in your applications. |
The message type field is populated with the data type of the message that is published to the ValidateOrder channel: org.example.request.QuoteRequestDocument
.
Note: | If the channels are not available for you to select in the Channel name field, you must build your Utility project. To do so, first click Cancel in the Insert Control dialog box to close it. Then right-click on the Utility Project folder in the Package Explorer pane and choose Build Project from the drop-down menu. When the project finishes building, click , and select Integration ControlsMB Publish on the Data Palette Controls tab to open the Insert Control dialog box. Repeat steps 4 through 6, as described above. The channels are now available in the channel-name field. (The channel files that define Message Broker channels in your application are located in a project, and must be built in that project for them to be available in your application. To learn how the ValidateOrder channel is defined, see Understanding the Message Broker Channels in Your Tutorial Application. |
void publish(QuoteRequestDocument value)
A Control Send node is created. By default, the node is named publish.
void publish (QuoteRequestDocument value)
method are already selected.
The Control Expects field is populated with the data type of the parameter expected by the control: QuoteRequestDocument
.
Note: | Recall that when you designed the Start node for your business process at the beginning of the tutorial, you assigned the Request for Quote messages from clients to the requestXML variable. |
You must create a Message Broker Subscription control in your project, then bind a method from the control to a node in your business process. Using the Message Broker Subscription control, your process subscribes to a channel on which Validation services can publish messages if the Request for Quote from the client is invalid. In the tutorial scenario, a ValidateOrder service determines that a Request for Quote is invalid if the number of widgets requested by a client is greater than 400. Complete the following steps:
This specifies the channel to which your business process subscribes. It is also the channel to which the ValidateOrder service publishes messages when it determines that a Request for Quote is invalid.
Note: | The message type field is populated with the data type of the message that is published to the StopQuote channel: java.lang.String . To learn how the StopQuote channel is defined, see
Understanding the Message Broker Channels in Your Tutorial Application. |
The Insert Control dialog box is closed and the MBSubValidate.java file is created and is visible in the Package Explorer pane. The instance of the mbSubValidate control you created is displayed in the Data Palette:
void subscribe()
A Control Send node is created. By default, the node is named subscribe. Note that the indicates that the specifications on this node are complete—no further work is required to design this node.
Note: | Message Broker Subscription controls do not define callback methods for you. You must define a custom callback to specify how the business process expects to receive the event messages. To define the callback for your business process, proceed to Step 14: Designing a Message Path for Your Business Process. |
This step completes the design of the nodes that specify how your RequestQuote process publishes and subscribes to Message Broker channels.
Understanding the Message Broker Channels in Your Tutorial Application