OrderedSample (BizTalk Server Sample)
The OrderedSample sample demonstrates how to use an orchestration to receive and send an ordered series of messages in a round-trip fashion.
What This Sample Does
The sample assumes there are messages in the MQSeries queue from which it receives messages. When the adapter reads the messages from MQSeries queue, it reads them in-order and submits them to BizTalk Server.
The receive port in the orchestration, mqreceive, has its Ordered Delivery property set to True.
For the send side, the orchestration sends a message and then waits for a delivery notification before sending the next message. The send port, mqsend has its Delivery Notification property set to Transmitted. To keep the example simple, the orchestration uses an infinite loop.
The orchestration can receive batches of messages and single messages.
Where to Find This Sample
<Samples Path>\AdaptersUsage\MQSeriesAdapter\OrderedSample
The following table shows the files in this sample and describes their purpose.
File | Description |
---|---|
OrderedReceiveSend.btproj, OrderedReceiveSend.sln |
Project and solution files for the application. |
OrderedReceiveSendOrchestration.odx | The orchestration of the application. |
OrderedSample.snk | The strong naming key file. |
Setup.bat | Builds and initializes this sample. |
Building and Running the Sample
To build and deploy the sample
In a command window, navigate to the following folder:
<Samples Path>\AdaptersUsage\MQSeriesAdapter\OrderedSample
Run the file Setup.bat, which performs the following actions:
Creates a strong name key for the project.
Compiles and deploys the orchestration project.
If you have the required permissions to the MQSeries Server for Windows installation, you can create the MQSeries queue through the adapter dialog boxes, and can skip the next procedure. If you do not have such access, you can create the queue using the IBM WebSphere MQ Explorer. To create the queues through the WebSphere MQ Explorer, complete the following steps.
Creating the MQSeries Queues Through the WebSphere MQ Explorer
To create the MQSeries queues through the WebSphere MQ Explorer
Click Start, point to All Programs, point to IBM WebSphere MQ, and then click WebSphere MQ Explorer.
Double-click Queue Managers, and then double-click the default queue manager. The default queue manager is typically named QM_<machine_name> where machine_name is the name of your computer.
Right-click Queues, point to New, and then click Local Queue.
In Create Local Queue dialog box, in Queue Name, type "queue1", and then click OK.
Right-click Queues, click New, and then click Local Queue.
In the Create Local Queue dialog box, in Queue Name, type "queue2", and then click OK.
Creating the Receive Location and the MQSeries Queue
This procedure creates the send port and receive location to send the message to and receive the correlation message from MQSeries. The MQSeries queue will also be created when you create the receive location if not already created.
To create the receive location and the MQSeries queue
Open the BizTalk Server Administration console.
Expand BizTalk Server Administration, expand BizTalk Group, expand Applications, and then expand the required application.
Right-click Receive Ports, point to New, and then click One-way Receive Port.
In the One-way Receive Port Properties dialog box type, in the Name box type OrderedSampleReceive and click OK.
In the left pane, click Receive Locations tab, and then click New.
In the Receive Location Properties dialog box, in the Name box type "OrderedSampleReceiveLocation".
In the Transport Type box, select MQSeries.
In the Receive Handler box, select BizTalkServerApplication.
In the Receive pipeline box, select Microsoft.BizTalk.DefaultPipelines.PassThruReceive.
Click Configure.
In the MQSeries Transport Properties dialog box, in the Polling Interval box, type "10".
In the Queue Definition box, click the ellipsis (…) button.
In the Queue Definition dialog box, in the Server Name box, type your computer name.
In the Queue Manager box, select the default queue manager.
In the Queue box, type " queue1", and then click Export.
In the Export dialog box, click Create Queue, and then click OK or Done until you have exited all dialog boxes.
Creating the Send Port and MQSeries Queue
To create the send port and MQSeries queue
Right-click Send Ports, point to New, and then click Static One-way Send Port.
In the Static Port Properties dialog box type, in the Name box, type "OrderedSampleSend".
In the Transport Type box, select MQSeries.
In the Send pipeline box, select Microsoft.BizTalk.DefaultPipelines.PassThruTransmit.
Click Configure.
In the MQSeries Transport Properties dialog box, in the Queue Definition box, click the ellipsis (…) button.
In the Queue Definition dialog box, in the Server Name box, type your computer name.
In the Queue Manager box, select the default queue manager.
In the Queue box, type " queue2", and then click Export.
In the Export dialog box, click Create Queue, and then click OK or Done until you have exited all dialog boxes.
To enable the receive location and start the send port
In the BizTalk Server Administration console, click Receive Ports.
In the details pane, right-click the MQIn receive location and click Enable.
In the details pane, right-click the MQOut send port and click Start.
To bind and start the Orchestration
In the BizTalk Server Administration console, expand the Orchestrations folder.
Double-click the OrderedSampleOrchestration orchestration, and then click Bindings.
Bind the orchestration ports to the following send ports and receive locations:
Orchestration Port Messaging Port / Receive Location mqreceive OrderedSampleReceive mqsend OrderedSampleSend Click Host.
In the Host box, select BizTalkServerApplication, and click OK.
Right click the Orchestration and click Start.
To run the sample
Start the orchestration.
Put messages into the MQSeries queue from which you have configured the receive location to read.
View the messages in WebSphere MQ Explorer in the send queue to which you have configured the send port to send messages.