Running the RegexFilterNode 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 for running this sample is based on the following format:

<regexfilter>
<regex>out</regex>
</regexfilter>

where regex is the value of the user-defined property filterField (default is regex), and out is the value of the user-defined property filterRegex (default is out). When the value of the filterRegex is out, the message is routed to the Out terminal of the RegexFilterNode. A value of anything else routes the message to the Alternate terminal.

Running the sample

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

To run the sample:

  1. Expand the folders under the JavaComputeNodeSampleFlowProject.
  2. Double-click RegexFilterNodeMessage.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.REGEX.IN queue. The message flow uses the RegexFilterNode node to route the message to either the JAVACOMPUTE.REGEX.OUT queue or the JAVACOMPUTE.REGEX.ALTERNATE queue, depending on the value of the user-defined property filterRegex.
  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 output message with the expected output message.

Edit the input message so that the value of filterRegex is not out, and then try repeating the previous steps. The message is routed to the JAVACOMPUTE.REGEX.ALTERNATE queue instead.

If all the preceding steps are successful, the sample is complete. Look at the Java code in the RegexFilterNodeFlow 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 for filterRegex, the message is routed to the Out terminal, otherwise it is routed to the Alternate terminal.

<regexfilter>
<regex>out</regex>
</regexfilter>

Back to Running the JavaCompute Node sample