-
Notifications
You must be signed in to change notification settings - Fork 82
Add TCPMon with WSO2 MI integration diagrams and documentation #1823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Iduranga-Uwanpriya
wants to merge
1
commit into
wso2:main
Choose a base branch
from
Iduranga-Uwanpriya:fix/tcpmon-mi-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,3 +53,164 @@ To monitor messages from client to server using TCPMon: | |
| windows. | ||
|
|
||
|  | ||
|
|
||
| ## Using TCPMon with WSO2 Micro Integrator | ||
|
|
||
| This section shows how to integrate TCPMon with **WSO2 Micro Integrator (MI)** so you can observe messages flowing between clients, MI, and backend services during development and troubleshooting. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - WSO2 Micro Integrator **4.4.0+** | ||
| - TCPMon (Apache Axis utility) | ||
| - Java 8+ | ||
| - MI running locally (default HTTP port **8290**) | ||
|
|
||
| !!! note | ||
| TCPMon works at the TCP level and is ideal for **HTTP** traffic during debugging. | ||
| For HTTPS, either configure trusted certificates end-to-end or switch services to HTTP temporarily while you debug. | ||
|
|
||
| --- | ||
|
|
||
| ### Monitor inbound messages (Client → MI) | ||
|
|
||
| Use TCPMon as a listener **in front of MI** so all client requests pass through it. | ||
|
|
||
|  | ||
|
|
||
| 1. **Start TCPMon** and create a new listener: | ||
| - **Listen Port**: `8081` (any free local port) | ||
| - **Target Host**: `localhost` | ||
| - **Target Port**: `8290` (MI default HTTP port) | ||
|
|
||
| 2. **Send client requests via TCPMon**, not directly to MI. | ||
|
|
||
| For example, if your MI proxy is normally at: | ||
| ``` | ||
| http://localhost:8290/services/SimpleProxy | ||
| ``` | ||
|
|
||
| send requests to: | ||
| ``` | ||
| http://localhost:8081/services/SimpleProxy | ||
| ``` | ||
|
|
||
| 3. Observe in TCPMon: | ||
| - **Left pane** → incoming request from client | ||
| - **Right pane** → response returned by MI | ||
|
|
||
| --- | ||
|
|
||
| ### Monitor outbound messages (MI → Backend) | ||
|
|
||
| Route MI's **endpoint** through a second TCPMon listener to capture calls MI makes to upstream/backends. | ||
|
|
||
|  | ||
|
|
||
| 1. **Start another TCPMon** instance: | ||
| - **Listen Port**: `8082` | ||
| - **Target Host**: `<real-backend-host>` (e.g., `backend.example.com`) | ||
| - **Target Port**: `<real-backend-port>` (e.g., `9000`) | ||
|
|
||
| 2. **Point your MI endpoint to TCPMon** instead of the real backend. | ||
| Example Proxy Service: | ||
| ```xml | ||
| <proxy name="SimpleProxy" startOnLoad="true" transports="http"> | ||
| <target> | ||
| <inSequence> | ||
| <log level="full"/> | ||
| <send> | ||
| <endpoint> | ||
| <!-- Route via TCPMon (8082) instead of the real backend --> | ||
| <address uri="http://localhost:8082/services/BackendService"/> | ||
| </endpoint> | ||
| </send> | ||
| </inSequence> | ||
| <outSequence> | ||
| <send/> | ||
| </outSequence> | ||
| </target> | ||
| </proxy> | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ### End-to-end example (both directions) | ||
|
|
||
| The setup below shows how to monitor both inbound and outbound traffic using two TCPMon instances. | ||
|
|
||
|  | ||
|
|
||
| | Flow | Source | → | Destination | TCPMon Mapping | | ||
| |------|----------|---|--------------|----------------| | ||
| | Inbound | Client | → | Micro Integrator | TCPMon `8081 → 8290` | | ||
| | Outbound | Micro Integrator | → | Backend Service | TCPMon `8082 → 9000` | | ||
|
|
||
| 1. Start TCPMon **#1**: Listen on **8081**, target **localhost:8290** | ||
| 2. Start TCPMon **#2**: Listen on **8082**, target your backend (e.g., `backend.example.com:9000`) | ||
| 3. Update the MI endpoint to `http://localhost:8082/...` | ||
| 4. Send requests to `http://localhost:8081/services/SimpleProxy` | ||
|
|
||
| **You can now view:** | ||
| - Requests/responses between **Client ↔ MI** in TCPMon 8081 | ||
| - Requests/responses between **MI ↔ Backend** in TCPMon 8082 | ||
|
|
||
| --- | ||
|
|
||
| ### Practical Use Cases | ||
|
|
||
| #### Use Case 1: Debugging SOAP Message Transformation | ||
|
|
||
|  | ||
|
|
||
| **Scenario:** You need to verify that SOAP envelopes are correctly transformed to REST JSON before reaching the backend. | ||
|
|
||
| **Setup:** | ||
| - Client sends SOAP requests to TCPMon (8081) | ||
| - TCPMon forwards to MI which transforms SOAP to REST | ||
| - MI sends JSON to backend REST API | ||
| - View XML format in TCPMon to debug transformation issues | ||
|
|
||
| --- | ||
|
|
||
| #### Use Case 2: Debugging Authentication Headers | ||
|
|
||
|  | ||
|
|
||
| **Scenario:** Debug authentication issues by inspecting whether authorization headers are being correctly passed or modified. | ||
|
|
||
| **Setup:** | ||
| - Client sends requests with Authorization headers to TCPMon (8081) | ||
| - TCPMon captures headers for inspection | ||
| - MI may modify or add additional headers via Header Mediator | ||
| - Backend API validates and responds with 200 OK or 401 Unauthorized | ||
| - Verify headers are correctly passed or modified by MI | ||
|
|
||
| --- | ||
|
|
||
| #### Use Case 3: Load Balancing & Failover Testing | ||
|
|
||
|  | ||
|
|
||
| **Scenario:** Test load balancing behavior and verify requests are distributed correctly across multiple backend servers. | ||
|
|
||
| **Setup:** | ||
| - Client sends load test requests to TCPMon (8081) | ||
| - TCPMon forwards to MI Load Balance Endpoint | ||
| - MI distributes requests across Server 1 and Server 2 | ||
| - Monitor distribution to ensure proper load balancing and failover | ||
|
|
||
| --- | ||
|
|
||
| ### Tips & troubleshooting | ||
|
|
||
| - **Port in use?** Pick any free local port for the TCPMon listener (e.g., 8083/8084). | ||
| - **Nothing appears in TCPMon?** Ensure your client or MI **actually targets the TCPMon port** (8081/8082). | ||
| - **HTTPS traffic?** Use HTTP for debugging or configure certificates so TCPMon can handle TLS. | ||
| - **Headers/payloads:** Enable **XML view** in TCPMon to inspect SOAP/REST bodies. | ||
|
|
||
| --- | ||
|
|
||
| ### References | ||
|
|
||
| - [Apache TCPMon Documentation](https://ws.apache.org/tcpmon/) | ||
| - [WSO2 MI Docs – Message Monitoring with TCPMon](https://mi.docs.wso2.com/en/latest/observe-and-manage/classic-observability-tcp/message-monitoring-with-tcpmon/) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove this since it points to the same page here. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1213,6 +1213,6 @@ extra: | |
| version: 1.2.0-1 | ||
| git_tag: v1.2.0.1 | ||
| site_version: 4.5.0 | ||
| #base_path: http://localhost:8000/en/latest | ||
| base_path: http://localhost:8000/en/latest | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we revert this line back? |
||
| base_path: https://mi.docs.wso2.com/en/4.5.0 | ||
| envoy_path: https://www.envoyproxy.io/docs/envoy/v1.24.1 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the Call mediator here