WebSphere Message Broker, Version 8.0.0.7 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

Combining a WebSphere MQ message with an XML file using the contents of the message to identify which file to use

Combine an incoming message with the contents of an XML file, using fields in the message to determine which file to use.

Before you start: Put a file on the file system that is local to the broker, for the FileRead node to read. Here is an example of the file contents:

<Data>Purchase details</Data>

In this example, the contents of the data in the data tag are inserted into the incoming message. Any valid XML structures can be added to this section.

Make a note of the path to the file. For example: c:\temp\FileRead\task3.xml or /tmp/FileRead/task3.

Create the following queues on the broker queue manager:

  • FILEREAD.TASK3.IN1
  • FILEREAD.TASK3.OUT1

Detailed information about configuring the node is given on the property panels for the node, in the WebSphere® Message Broker Toolkit.

  1. Create a message flow that contains an MQInput node, a FileRead node, and an MQOutput node.
  2. Wire the terminals as follows:
    1. Wire the Out terminal of the MQInput node to the In terminal of the FileRead node.
    2. Wire the Out terminal of the FileRead to the In terminal of the MQOutput node.
  3. Configure the MQInput node:
    1. On the Basic panel, set the Queue name to FILEREAD.TASK3.IN1
    2. On the Input Message Parsing panel set the domain to XMLNSC.
  4. Configure the FileRead node.
    1. On the Basic panel, set the directory and file name to refer to the XML file. For example: c:\temp\FileRead and task3.xml or /tmp/FileRead and task3.
    2. Configure the Result panel:
      1. Set the Result data location to $ResultRoot/XMLNSC/Data
      2. Set the Output data location to $InputRoot/XMLNSC/Data
    3. Configure the Input Message Parsing panel:
      1. Set the Domain to XMLNSC
  5. Configure the MQOutput node:
    1. On the Basic panel, set the Queue name to FILEREAD.TASK3.OUT1
  6. Deploy the message set and message flow.
  7. Change the Directory and Name fields to the correct location of the file, and then put the following XML message onto queue FILEREAD.TASK2.IN1:
    <Invoice>
      <Directory>c:\temp\FileRead</Directory>
      <Name>task2.xml</Name>
      <Data/>
    </Invoice>

The broker routes the message to the queue FILEREAD.TASK3.OUT1 and inserts data from the file into the Data field of the output message:

<Invoice>
  <Directory>c:\temp\FileRead</Directory>
  <Name>task2.xml</Name>
  <Data>Purchase details</Data>
</Invoice>
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2016Copyright IBM Corporation 1999, 2016.

        
        Last updated:
        
        Last updated: 2016-05-23 14:47:58


Task topicTask topic | Version 8.0.0.7 | bc34094_