Export (0) Print
Expand All

MQSSendPipelineComponent (BizTalk Server Sample)

[Unless specifically noted, the content in this topic applies to BizTalk Server 2013 and 2013 R2.]

This sample demonstrates how to write a pipeline component that reads a set of MQSeries property values from an XML file and applies them to a message.

This sample is composed of two Visual Studio projects, a pipeline component project and a pipeline project that makes use of the pipeline component.

  • <SamplesPath>\AdaptersUsage\MQSeriesAdapter\MQSSendPipelineComponent\SetMQSeriesHeaderPropertyComponent

  • <SamplesPath>\AdaptersUsage\MQSeriesAdapter\MQSSendPipelineComponent\SetMQSeriesHeaderPropertyPipeline

The following table shows the files in this sample and describes their purpose.

 

FileDescription

SetMQSeriesHeaderPropertyComponent\SetMQSeriesHeaderPropertyComponent.sln,

SetMQSeriesHeaderPropertyComponent\SetMQSeriesHeaderPropertyComponent.csproj

The project and solution files for the pipeline component.

SetMQSeriesHeaderPropertyComponent\CSetMQSeriesHeaderPropertyComponent.cs

The Visual C#® source file for the pipeline component.

SetMQSeriesHeaderPropertyComponent\SetMQSMQMDHdrProps.xml

The MQSeries properties read and used by the pipeline component.

SetMQSeriesHeaderPropertyPipeline\SetMQSeriesHeaderPropertyPipeline.btproj,

SetMQSeriesHeaderPropertyPipeline\SetMQSeriesHeaderPropertyPipeline.sln

The project and solution files for the BizTalk pipeline.

SetMQSeriesHeaderPropertyPipeline\SetMQSeriesHeaderPropertyPipeline.snk

The strong naming key file for the BizTalk pipeline project.

SetMQSeriesHeaderPropertyPipeline\SetMQSeriesHeaderPropertyPipeline.btp

The BizTalk Server pipeline.

To create the application, you must complete the following steps:

  1. Create the folders for the application.

  2. Modify and compile the Visual Studio project for the pipeline component.

  3. Copy the compiled assembly and the header file to the appropriate folders.

  4. Modify the Visual Studio project for the BizTalk Server pipeline.

  5. Compile and deploy the BizTalk Server pipeline project.

  6. Set up a BizTalk Server receive location.

  7. Create a MQSeries queue.

  8. Set up a send port.

  9. Enable the receive location and start the send port.

This procedure creates the appropriate folders for the application.

To create the folders for the application

  1. Create a folder named temp on your C:\ drive if it does not already exist.

  2. Create a folder under the C:\temp directory named Pickup3.

This procedure modifies and compiles the Visual Studio project for the pipeline component.

To modify and compile the project for the pipeline component

  1. Double-click the solution file, SetMQSeriesHeaderPropertyComponent\SetMQSeriesHeaderPropertyComponent.sln to open the solution in Visual Studio.

  2. Double-click the class file CSetMQSeriesHeaderPropertyComponent.cs to open the class file in Visual Studio.

  3. Locate the variable samplesDir, verify that this variable is set to the location C:\temp.

  4. Right-click the solution in the Solution Explorer and click Build. This will compile the project into a dll located in the SetMQSeriesHeaderPropertyComponent\SetMQSeriesHeaderPropertyComponent\bin\Debug\ directory.

This procedure copies the compiled assembly and the header file to the appropriate folders.

To copy the compiled assembly and header file to the appropriate folders

  1. Copy the compiled assembly SetMQSeriesHeaderPropertyComponent.dll to the BizTalk pipeline components folder. The default location for the BizTalk pipeline components folder is drive:\Program Files\Microsoft BizTalk Server 2013 R2\Pipeline Components.

  2. Copy the MQHeader properties file SetMQSMQMDHdrProps.xml to the C:\temp directory.

This procedure modifies the Visual Studio project for the BizTalk Server pipeline.

To modify the project for the BizTalk Server pipeline

  1. In Visual Studio, open the solution by double-clicking the solution file, SetMQSeriesHeaderPropertyPipeline\SetMQSeriesHeaderPropertyPipeline.sln.

  2. Create a strong name key file for the project. To do that, do the following:

    1. Open a Visual Studio Command prompt.

    2. Change directories to <SamplesPath>\AdaptersUsage\MQSeriesAdapter\MQSSendPipelineComponent.

    3. Type the following:

      sn -k MQSSendPipelineComponent.snk

    4. Press ENTER. This will create the key file.

  3. In Solution Explorer, right-click the project and click Properties to launch Project Designer for the project (in the center window).

    1. In the Project Designer, click Signing tab.

    2. In the right-hand pane, select the Sign the assembly option..

    3. Click drop-down list for the Choose a strong name key file option, and click Browse.

    4. Browse to <SamplesPath>\AdaptersUsage\MQSeriesAdapter\MQSSendPipelineComponent\MQSSendPipelineComponent.snk, click Open.

  4. The pipeline component that you created earlier is already added to the Pre-Assemble stage of this pipeline project. If this component was not already added you would need to complete the following steps to add it:

    1. In the Visual Studio IDE, click the Toolbox tab on the left side.

    2. Right-click the Toolbox, and click Choose Items.

    3. In the Choose Toolbox Items dialog box, click the BizTalk Pipeline Components tab, select the Custom Component to Set MQseries header propertiescomponent, and then click OK.

    4. Drag the Custom Component to Set MQseries header propertiescomponent to the Pre-Assemble stage of this pipeline.

This procedure compiles and deploys the BizTalk Server pipeline project.

To compile and deploy the pipeline project

  1. In the Solution Explorer window, right-click the solution, and then click Deploy Solution. This builds the solution and deploys the assembly to the BizTalk Management database.

  2. Verify the Assembly was deployed to the BizTalk Management database:

    1. Open the BizTalk Administration Console.

    2. Click to expand BizTalk Group [<servername>:<management database>], and then click to expand the Assemblies folder.

      The deployed pipeline assembly should be visible under the Assemblies folder.

This procedure creates a BizTalk Server receive location.

To create the receive location

  1. In the BizTalk Server Administration Console, right-click Receive Ports, point to New, and then click One-way Receive Port.

  2. In the One-way Receive Port Properties dialog box, in the Name box type "MQReply" and click OK.

  3. In the left pane, click Receive Locations tab, and then click New.

  4. In the Receive Location Properties dialog box, in the Name field, type "ReceiveFile".

  5. In the Transport Type box, select FILE.

  6. In the Receive Handler field, select BizTalkServerApplication.

  7. In the Receive pipeline field, select Microsoft.BizTalk.DefaultPipelines.PassThruReceive.

  8. In the Receive folder field, type "C:\temp\Pickup3".

  9. In the File mask field, type "*.*".

  10. Click OK, and then click OK again to exit the Receive Location Properties dialog box.

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 this next procedure.

If you do not have such access, you can use the following procedure to create the queue using the IBM WebSphere MQ Explorer.

To create a MQSeries queue through the MQSeries Explorer

  1. Click Start, point to Programs, point to IBM WebSphere MQ, and then click WebSphere MQ Explorer.

  2. 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.

  3. Right-click Queues, point to New, and then click Local Queue.

  4. In Create Local Queue dialog box, in Queue Name, type SETHEADER, and then click OK.

This procedure creates the send port for the output message. The MQSeries queue is also created when you create the send port if you have not already created it.

To create the send port and MQSeries queue

  1. Right-click Send Ports, point to New, and then click Static One-way Send Port.

  2. In the Send Port Properties dialog box, in the Name box, type "MQSolicitResponse".

  3. In the Transport Type box, select MQSeries.

  4. In the Send pipeline box, select SetMQSeriesHeaderPropertyPipeline.SetMQSeriesHeadersSendPipeline.

  5. In Filters, add a new entry with the following name/value pairs:

    • Set Property to "BTS.ReceivePortName".

    • Set Operator to "==".

    • Set Value to "ReceiveFile".

      noteNote
      This sets the send port to subscribe to messages that arrive on the ReceiveFile receive port.

  6. Click Transport.

  7. In the Address (URI) field, click the ellipsis (…) button.

  8. In the MQSeries Transport Properties dialog box, in the Queue Definition field, click the ellipsis (…) button.

  9. In the Queue Definition dialog box, in the Server Name field, type your computer name.

  10. In the Queue Manager field, select the default queue manager.

  11. In the Queue field, type "SETHEADER", and then click Export.

  12. In the Export dialog box, click Create Queue, and then click OK or Done until you have exited all dialog.

This procedure enables the receive location and start the send port.

To enable the receive location and start the send port

  1. In the BizTalk Server Administration console, click Receive Ports.

  2. In the details pane, right-click the MQIn receive location and click Enable.

  3. In the details pane, right-click the SetMQHeader send port and click Start.

This procedure tests the application.

To test the application

  1. Put a file into the C:\Temp\Pickup3 folder.

  2. Launch the WebSphere MQ Explorer and double-click the SETHEADER queue to examine the message(s) in the SETHEADER queue.

    To see all of the context properties for the messages in the SETHEADER queue, complete the following steps:

    1. Double-click the SETHEADER queue to display the Message Browser dialog box.

    2. In the Message Browser dialog box, click Columns to display the Show/Hide Columns for Messages dialog box.

    3. Under Available Columns, double-click each entry to make it visible in the Message Browser dialog box, and then click OK.

  3. The message context properties for each message should be visible in the Message Browser dialog box.

© 2014 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2015 Microsoft