Message Tracing is used to trace, track and visualize a message's body in each intermediate stage of its transmission. This is useful for a number of reasons, including auditing and debugging. You use the Activity Dashboard of WSO2 BAM to trace messages going through WSO2 ESB. It allows you to track and trace messages in real-time within Cassandra, without having to write Hive scripts.
Message tracing for the ESB
Follow the steps below to use WSO2 BAM to trace messages going through WSO2 ESB.
- This sample uses WSO2 ESB 4.8.0.
- The Message Tracing toolbox comes with BAM by default. You can view this by going to BAM Toolboxes -> List menu in the management console.
Installing the Message Tracer feature
- Download and set up WSO2 ESB.
- Log in to ESB management console and select Features under the Configure menu.
- In the Repository Management tab click Add Repository.
Enter a name for the new repository and its URL, and click Add as shown below.
- Go to the Available Features tab and select the newly added repository from the Repository drop-down list. Under Filter by feature name field, enter
BAM Message Tracer Handler Aggregate, select Show only the latest versions checkbox, and deselect Group features by category checkbox.
- Click Find Features.
Select BAM Message Tracer Handler Aggregate feature 4.2.3 version from the available features list and click Install.
When installing the BAM Message Tracer Handler Aggregate feature as shown below, select the 4.2.3 version since previous versions of this feature are not compatible with WSO2 BAM 2.5.0.
- Click Finish to complete the installation and click Shutdown/Restart on the left navigation menu to restart the server.
Configuring message tracing
On the Configure menu of ESB Management Console, click Message Tracing and then click Message Tracing Configuration.
Select all the checkboxes as illustrated below and enter the Receiver URL (in
tcp://[IP address of localhost]:[thrift port]format), Username and Password that is used by BAM. The default value for both the username and password will be admin.
For the receiver URL, enter the thrift port value that is obtained when running the start-up script of BAM, which can be found in the Carbon log. However, the default WSO2 BAM receiver port is 7611 and if you have set up a port offset, enter the port accordingly. For example, if the port offset is set to 2, enter the port as 7613 as shown below.
- Click Update to save the settings.
Publishing data to WSO2 BAM
After message tracing is configured, invoke a deployed service on WSO2 ESB (for example: echo service) for data publishing.
You need to first enable the relevant message tracer feature in WSO2 ESB before deploying the proxy service.
Log in to BAM management console and use the Cassandra Explorer, to check whether data is being published to BAM. Enter the default values as localhost:9160, admin and admin respectively for Connection URL, Username and Password and click Connect.
When entering the port in the connection URL,
localhost:9160should be changed accordingly if a port offset is applied. For example if the port offset is set to 1, then this will be
- In Keyspaces, check for the published contents in the BAM_MESSAGE_TRACE column family, which is located in the EVENT_KS keyspace.
- As soon as data is published and available, on the Main menu select Activity Dashboard to track and trace messages.
- In the Connect to Cluster window, enter the same details as entered in step 11 above and click Login.
- In the Search Activities window, enter the query details related to your search and click Search. For example:
You view the resulting activities of the search query you entered in the previous step as below:
The message tracing functionality of WSO2 BAM can be used for any Carbon based product. Also it can be used to to track and trace messages that are transmitted from one product to another in a sequential manner.