Running the RoutingFileNode sample

After you have imported and partially set up this sample, then performed the appropriate setup instructions, you can run the sample by following the instructions in the Running the sample section below.

This topic also includes an example input test message and a corresponding output message, so that you can confirm that the sample has worked.

Input test message

The test message used in running this sample is based on the following format:

<routingfilenode>
<routingvalue>out</routingvalue>
</routingfilenode>

where the value out contains the key identfier used to look up the terminal to which the message should be routed, from the routingtable.cfg properties file. This file is a simple text file containing:

out out
alternate alternate

To route the message to the alternate node, edit the input message and replace out with alternate.

Running the sample

This sample uses the message flow RoutingFileNodeFlow. It contains one input queue called JAVACOMPUTE.ROUTING.IN, and the message flow can route the message to one of three output queues (JAVACOMPUTE.ROUTING.OUT, JAVACOMPUTE.ROUTING.ALTERNATE and JAVACOMPUTE.ROUTING.FAILURE).

To run the sample:

  1. Switch to the Broker Application Development perspective on IBM WebSphere Message Broker Toolkit.
  2. Open the test message enqueue file, RoutingFileNodeMessage.
  3. Click Write to queue. A message is sent to the JAVACOMPUTE.ROUTING.IN queue. The message flow uses the RoutingFileNode node to route the message to either the JAVACOMPUTE.ROUTING.OUT queue or the JAVACOMPUTE.ROUTING.ALTERNATE queue, depending on the value between the <routingvalue> tags.
  4. To check that the message has reached the correct queue use the WebSphere MQ Explorer tool.
    1. Start WebSphere MQ Explorer.
    2. Expand the folders under the queue manager WBRK6_DEFAULT_QUEUE_MANAGER, and select Queues.
    3. When refreshing WebSphereMQ Explorer ensure that the Queues folder is selected and not an actual queue name. If you select a queue name, not all the queues shown will be refreshed.
  5. Refresh the queue display to show the current number of messages on each queue. A message should appear on the JAVACOMPUTE.ROUTING.OUT queue or the JAVACOMPUTE.ROUTING.ALTERNATE queue.
  6. To view this output message, go back to IBM WebSphere Message Broker Toolkit and click Get a message from a Queue on the toolbar.
  7. Type in a Queue Manager name of WBRK6_DEFAULT_QUEUE_MANAGER, and a Queue name of JAVACOMPUTE.ROUTING.OUT or JAVACOMPUTE.ROUTING.ALTERNATE.
  8. Click Read From Queue to display the contents of the output message.
  9. Compare this with the expected output message.

Try repeating the steps above, after editing the input message so out is replaced with alternate. You should see the message routed to the JAVACOMPUTE.ROUTING.ALTERNATE queue instead.

If all the steps above have worked then the sample is complete. Take a look at the Java code in the message flow RoutingFileNodeFlow to see how the message routing was achieved.

Expected output message

The output message from the sample should be identical to the input message, as this sample covers only routing of messages, not transformation. When the input message contains a value of out, then the message is routed to the out terminal. If it contains alternate, it is routed to the alternate terminal.

<routingfilenode>
<routingvalue>out</routingvalue>
</routingfilenode>

Main Page iconBack to Running the JavaCompute Node sample