As we are running both ESB and BAM server concurrently we should change the port number of ESB by applying an offset. In order to apply an offset, in the ESB product directory go to $esb_home/repository/conf and open file, carbon.xml . Then change the value in xpath Server/Ports/Offset from '0' to some other integer.
To start the server, on Linux
wso2server.sh
on MS Windows
wso2server.bat
Start WSO2 ESB on Linux,
After starting the server, go to ESB management console Configure→Features→Settings menu.
Give P2 repository link either from as a URL or from a file.
Then click 'Add'.
Go to 'Available Features' tab and select the above repository.
Click 'Find Features'.
User can see all available features. From those, select 'BAM Mediation Data Agent Aggregate' feature.
Click 'Install'.
Click 'Next' and accept the license agreement.
Restart the WSO2 ESB server.
Setting the Backend Server
In the ESB product directory go to $esb_home/samples/axis2Server/src/SimpleStockQuoteService and build the backend service with Apache Ant. (You need to install Apache Ant before that.)
Go to $esb_home/samples/axis2Server and run the Axis2 server.
For Linux,
axis2server.sh
For Windows,
axis2server.bat
Now test whether the proxy service WSDL exists in http://localhost:9000/services/SimpleStockQuoteService?wsdl
Adding a proxy service to WSO2 ESB
Go to ESB management console and select Main→Web Services→Add→Proxy Service from the side panel.
Click on 'WSDL Based Proxy' to create a new WSDL based proxy.
Fill the form.
Insert suitable Proxy Service Name (eg: Simple_Stock_Quote_Service).
Set http://localhost:9000/services/SimpleStockQuoteService?wsdl as the WSDL URI.
Set 'SimpleStockQuoteService' as the WSDL Service.
Set 'SimpleStockQuoteServiceHttpSoap11Endpoint' as the WSDL Port.
Click 'Create'.
Select newly created proxy's name (here 'Simple_Stock_Quote_Service') form the shown list to see the Service Dashboard of it.
Now click 'Enable Statistics' to set the ESB to send statistics to the BAM.
Configuring Mediation Data Publisher
Go to ESB management console and select Configure→Mediation Data Publishing from side panel.
Fill the form.
Tick on 'Enable Mediation Stats'.
Set the 'BAM URL' as the URL of the BAM server. e.g. : https://localhost:9443
Set user name and password as 'admin'.
Let the default setting and value remain for 'socket' and 'port' in 'Transport'.
Click 'Update'.
Sample data format for mediation statistic data agent as follows.
In the ESB product directory go to $esb_home/samples/axis2Client
Build the backend service with Apache Ant (You need to install Apache Ant before that.) with the following code.
ant stockquote -Daddurl=https://localhost:8244/services/Simple_Stock_Quote_Service -Dmode=fullquote
(Here 'addurl' value should be given from the https endpoint located in Simple_Stock_Quote_Service's service dashboard that can be navigated by going to the ESB management console Main→Web Services→List from side panel and selecting 'Simple_Stock_Quote_Service' )
Now the proxy service Simple_Stock_Quote_Service should have dumped statistics and messages from the ESB to the EVENT table in the Cassandra database. Data in the Cassandra database can be seen by from the CLI using Cassandra Client.
Using the BAM server it can execute analyzers and store results to summary tables which can be visualized by the Gadget IDE in BAM.