WSO2 Enterprise Integrator is a comprehensive integration solution which enables communication among various disparate applications. Integration processes include:
- Invoking several applications
- Database operations
- Message routing
- Message transformations
Since there will be hundreds of integration components running within one message flow, it will be really difficult to identify a failure point. When it comes to breakpoints we may need to start the WSO2 Enterprise Integrator server in debug mode which adds a latency of starting servers. As such, I’m going to explain a method to perform debugging without starting the WSO2 Enterprise Integrator server in this blog.
What Does the TCP/IP Monitor Do?
The TCP/IP monitor acts as a simple server that monitors all the requests passing through and responses coming to WSO2 Enterprise Integrator. Just as we can use TCP/IP monitor to capture invoke latencies, we can use the TCP/IP monitor to block certain invocations during test time.
Using TCP/IP Monitor
I do have the following WSO2 Enterprise Integrator service, which will handle online order requests. First, it will check items in the inventory and then it will proceed the payment for the order. After that, it will process orders in the order handling system.
I have three endpoints:
- Inventory system (https://172.25.37.172:8080/inventory)
- Payment system (https://188.8.131.52:9080/payment)
- Order processing system (https://184.108.40.206:7800/order)
Now I want to monitor incoming and outgoing requests for the above mentioned endpoints. What the TCP/IP monitor does is that it intercepts these URLs by a specific port in localhost. For example, we can add a monitor to the TCP/IP monitor saying if a request comes to localhost port 5900 redirect it to 172.25.37.172:8080
The following will be TCP/IP URLs for the above endpoints:
actual URL > https://172.25.37.172:8080/inventory)new URL > https://localhost:7801/inventory
actual URL > https://220.127.116.11:9080/payment
new URL > https://localhost:7802/payment
actual URL > https://18.104.22.168:7800/order
new URL > https://localhost:7803/order
Step 1: Open the TCP/IP Monitor
Open integration studio* or your eclipse IDE. Go to Window> Show View > Others >Debug>TCP/IP monitor.
Go to the arrow in the upper right corner and go to properties.
Now the preferences window will appear. Here you can specify the endpoints you want to monitor.
Add Endpoint monitors by clicking the add button. After that, the screen below will appear. Now add the monitors one by one.
In the local monitoring port, you have to add the port which you are going to allocate in the localhost for monitoring that service. (For inventory system this is 7801.) The hostname is the actual URL hostname (for inventory system this is 172.25.37.172). Port is the port in the actual URL (for inventory system this is 8080).
Select the created TCP/IP monitors in the preferences tab and click start. You will need to start all monitors one by one.
Click apply and close the button.
Now go to your WSO2 Enterprise Integrator endpoints and add representing localhost URLs instead of actual URLs.
Now redeploy and invoke your service.
You will be able to see all invocation requests and response data payloads in the TCP/IP monitor window. When you select a particular invoke, you will see its request time, response time, input payload, output payload, request size, response size, and headers. You can differ response viewer type and encoding type based on your invoke types.
Let’s say you want to test the behavior of the Message Flow when the payment service is unreachable. You can stop the TCP/IP monitor related to that payment process and invoke your flow.
I wrote this blog post to give you a better understanding of how you can debug your system easily. Please remember to change your endpoint URLs to actual endpoint URLs before deploying it to the production environment. Happy debugging!
Note: WSO2 Integration Studio is a simple graphical editor based on eclipse developer environment which is ideal for developing and managing artifacts. You can download WSO2 Integration Studio here.