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.
The sample contains one Application with two message flows:
No transformation is done in either of the message flows; they just move data from files to TCP/IP sockets and back again.
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.
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.