Running the RoutingFileNode sample

After you have imported and deployed the sample, you can run it by following the instructions in the Running the sample section.

If you encounter any problems when you run the sample, see Resolving problems when running samples in the WebSphere Message Broker documentation.

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 that is used to run this sample is based on the following format:

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

where the value out contains the key identfier that is used to look up the terminal to which the message is 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. 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. Expand the folders under the JavaComputeNodeSampleFlowProject.
  2. Double-click RoutingFileNodeMessage.mbtest to open the file in the Test Client.
  3. Click Enqueue.
  4. Click Send message in the Detailed Properties panel. 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.
  5. To view this output message, go back to the WebSphere Message Broker Toolkit and click Dequeue on the Message Flow Test Events panel.
  6. Click Get Message in the Detailed Properties panel to display the contents of the output message.
  7. Compare this message with the expected output message.

Edit the input message so that out is replaced with alternate, and then try repeating the previous steps. The message is routed to the JAVACOMPUTE.ROUTING.ALTERNATE queue instead.

If all the preceding steps are successful, the sample is complete. Look at the Java code in the RoutingFileNodeFlow message flow to see how the message routing was achieved.

Expected output message

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

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

Back to Running the JavaCompute Node sample