This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
TCPMon Monitoring
This section explains how TCPMon can be used to monitor the ESB. Following topics are covered.
Introduction to TCPMon
Users can view and monitor the messages passed along a TCP-based conversation using the TCPMon utility. Therefore, this is a convenient tool, particularly useful for debugging when you develop Web services. TCPMon is an Apache project distributed under Apache 2.0 License.TCPMon is not dependent on any third party libraries. Its user interface is based on a swing UI and works on almost all platforms that support Java.
TCPMon is most commonly used to monitor the communication between the client (front end) and the back end server.Â
The following diagram depicts a typical communication between the front end client and the back end server. 80 is the listening port of the back end server which receives the messages from the client.
TCPMon can be used as an intermediary between the client and the server in order as shown below in order to monitor the messages. 8081 is the listening port in TCPMon which receives the messages from the client instead of the back end server.
Starting TCPMon
TCPMon is available in the <ESB_HOME>/bin
 directory of any WSO2 Carbon based product distribution. Alternatively, you can download TCPMon from Apache and run the tool.
Running TCPMon (from Carbon product pack)
Ensure that the following prerequisites are fulfilled in order to run TCPMon.
- Install JDK 1.4 or later version.
Set theÂ
JAVA_HOME
 variable. This setting is required only if you are using the TCPMon available in the WSO2 Carbon based product pack.For information on how to set the
JAVA_HOME
variable, go to Installing the Product, select the instructions relevant to your operating system and refer the 'Setting JAVA_HOME' section.
To run the TCPMon available with your WSO2 Carbon product pack:
- Go toÂ
<PRODUCT_HOME>/bin
 directory of your product pack. Execute the following command to run the tool.
For Windowstcpmon.bat
For Linux
./tcpmon.sh
Running TCPMon (downloaded from Apache)
To download TCPMon from Apache and run the tool:Â
- Download TCPMon from the following location:Â http://archive.apache.org/dist/ws/tcpmon/1.0/tcpmon-1.0-bin.zip.
- Extract tcpmon-1.0-bin.zip archive.
- Go to the build of the extracted directory to find the execution script.
- Execute the following command to run the tool.
For Windows
tcpmon.bat
For Linux
./tcpmon.sh
Monitoring ESB with TCPMon
The following diagram illustrates the typical message flow when a proxy service is involved in a communication between a client and a server.
In this scenario the proxy service is listening from port 8280 and the backend server is listening from port 9000.
There are two connections in this scenario:
- Client to proxy service connection.
- Proxy to backend server connection.
Â
Monitoring client to proxy service connection
In this scenario, the message flow between the client and the proxy service is monitored as illustrated in the following diagram.
To monitor the client to proxy service connection:
- Start TCPMon and enter the listener properties. Enter
8281
as the listener port,8280
as the target port, and then click Add. - Run sample 150 as follows. See Setting Up the ESB Samples for detailed instructions on how to run a sample.
- Execute one of the following commands to start the ESB with the configuration for sample 150.
- On Windows:Â
wso2esb-samples.bat -sn
Â150
- On Linux/Solaris: ./
wso2esb-samples.sh -sn 150
- On Windows:Â
- Execute one of the following commands to start the the Axis2 server.
- On Windows:Â
axis2server.bat
On Linux/Solaris:Â ./Â
axis2server.sh
- On Windows:Â
- Run
ant
from theÂ<ESB_HOME>/samples/axis2Server/src/SimpleStockQuoteServiceÂ
directory. Run the following ant command from theÂ
<ESB_HOME>/samples/axis2Client
directory.ant stockquote -Daddurl=http://localhost:8281/services/StockQuoteProxy
By specifying the URL as shown above, you will be sending the request to port 8281 (which is set as the listening port) instead of sending it directly to port 8280.
- Execute one of the following commands to start the ESB with the configuration for sample 150.
- The request and the response would be displayed in TCPMon as follows.
Â
Monitoring proxy service to backend connection
In this scenario, the message flow between the proxy service and backend is monitored as illustrated in the following diagram.
To monitor proxy service to backend connection:
- Start the ESB management console.
- Click List under Services in the left navigator to view the deployed services. Then click on the Source View link of the StockQuoteProxy service.
Configure the proxy service to send the request to port 9001 instead of sending it directly to port 9000. This can be done as follows.
<proxy name="StockQuoteProxy" xmlns="http://ws.apache.org/ns/synapse"> <target> <endpoint> <address uri="http://localhost:9001/services/SimpleStockQuoteService"/> </endpoint> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/> </proxy>
- Start TCPMon and enter
9001
as the listener port and9000
as the target port. Click Add. - Run sample 150 as follows.
- Execute one of the following commands to start the ESB with the configuration for sample 150.
- On Windows:Â
wso2esb-samples.bat -sn
Â150
- On Linux/Solaris: ./
wso2esb-samples.sh -sn 150
- On Windows:Â
- Execute one of the following commands to start the the Axis2 server.
- On Windows:Â
axis2server.bat
On Linux/Solaris:Â ./Â
axis2server.sh
- On Windows:Â
- RunÂ
ant
 from theÂ<ESB_HOME>/samples/axis2Server/src/SimpleStockQuoteServiceÂ
directory. Run the following ant command from theÂ
<ESB_HOME>/samples/axis2Client
 directory.ant stockquote -Daddurl=http://localhost:9001/services/SimpleStockQuoteService
- Execute one of the following commands to start the ESB with the configuration for sample 150.
- You will be able to see the request and the response as shown below.
Limitations
- TCPMon cannot be used to view messages transferred via the https protocol. However, you can view messages transferred via the https protocol in WSO2 ESB using the wire logs functionality.