About the Workload Management sample

This sample uses a small Java application which simulates a real-time backend system invoked via TCP/IP. The broker provides a batch interface to that application via files - the file is CR-LF delimited and contains a lot of records. The broker reads files from an input directory and sends each record to the backend TCP/IP application. It receives TCP/IP responses and appends them to another file. Using a large file as input to the flow allows a workload to be simulated which will run for long enough to observe the processing rate.

The backend program is designed to simulate a system which will not handle being called at a high rate, and will also show the rate at which it is being called.

A screen capture of a basic diagram of the sample architecture

Message flows

The sample contains one Application with two message flows:

  1. The message flow WLMSample_ProductSales_Producer.msgflow uses a FileInput node to read a record from the file WLMSample_QueryProductSalesByStores.xml and sent it out via a TCP/IP Client Output node. The output is hardcoded to connect to localhost:1445.
  2. The back-end application receives the record from the TCP/IP Client Output node. The application is capable of determining the rate at which it is processing messages.
  3. The message flow WLMSample_ProductSales_Consumer.msgflow receives the back-end response in a TCP/IP Client Input node and uses a FileOutput node which appends the record to the file WLMSample_ProductSalesByStoresData.xml.

No transformation is done in either of the message flows; they just move data from files to TCP/IP sockets and back again.

Back-end application

The sample backend application is a Java program which is invoked on the command line, and runs as a graphical window that gives an indication of the rate at which it is receiving messages. There is a batch file (Windows) or shell script (Linux) which launches the program. It takes two parameters as follows:

slow_tcpip_app <tcpip_port> <max_rate>

The sample message flow requires the port to be 1445. The maximum rate is normally set to 10 and it represents messages per second.

The application expects to receive records which are delimited by the 0x00 (null) character, and it replies with null-delimited strings. The response data that the backend application sends is a fixed string, either Success or Fail. Fail is issued if the rate of incoming requests exceeds the value set on the command line. The application also issues text messages to the console while it is receiving messages showing whether it is below the maximum value, above the maximum, or at the maximum value.

Applying Workload management settings

When the sample is imported, the default BAR file does not contain any limits on processing rate, so it is likely that the back-end application will report that its rate limit has been exceeded as soon as an input file is presented to the message flow.

You can set a maximum processing rate on the WLMSample_ProductSales_Producer message flow to control the rate at which the backend application is called. There are several methods of doing this which are described in the Setting the maximum flow rate documentation.

Back to sample home