Unknown macro: {next_previous_links2}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This section demonstrates a scenario where the ESB profile of WSO2 EI interacts with a simple Axis2 service when a client sends JSON messages. The ESB profile artifact used are then monitored by WSO2 EI Analytics.

In this scenario, a JSON client needs to connect with a Stockquote service. The client can send requests that contain company names in JSON format. However, the backend server can only serve SOAP messages. The ESB profile carries out the mediation so that the client can communicate with the backend server.

WSO2 EI Analytics collects the statistics for the REST API and the 5 mediators with which the mediation is performed, and presents them in the WSO2 Analytics Dashboard.

Follow the steps below to try this scenario.

Prerequisites

In order to try this tutorial, you need to download and install the ESB and Analytics profiles of WSO2 EI. For instructions, see Installation Guide.

Step 1 - Configure the ESB profile to publish statistics

This step involves doing the required configurations to ensure that statistics are published in the WSO2 EI Analytics Dashboard when you invoke the StockQuote service.

Enable mediation statistics and message tracing by setting the following properties in the  <EI_HOME>/repository/conf/synapse.properties  file.

mediation.flow.statistics.enable=true
mediation.flow.statistics.tracer.collect.payloads=true
mediation.flow.statistics.tracer.collect.properties=true

Step 2 - Deploy the required ESB profile artifacts

This step involves uploading the ESB profile artifacts required for this scenario using a CAR file.

  1. Download and save ESB_Artifacts_1.0.0.car in a preferred location in your computer.
  2. Start the Analytics profile. For instructions, see Starting the Analytics profile.

    The WSO2 EI Analytics profile needs to be started before the ESB profile in order to be updated with the ESB profile statistics when they are published.

  3. Start the Analytics profile. For instructions, see Starting the ESB profile.
  4. Log into the Management Console of the ESB profile using the following URL: https://<EI_HOST>:<EI_PORT>/carbon/
  5. In the Main tab, click Add under Carbon Applications. This opens the Add Carbon Applications page.
  6. Click Browse, and browse for the ESB_Artifacts_1.0.0.car file you saved in your computer. Then click Upload.
  7. In the Main tab, click APIs to open the Deployed APIs page. An API named StockQuoteAPI. Enable statistics and tracing for this API by clicking Enable Statistics and Enable Tracing.

Step 3 - Set up the Stockquote service

Follow the procedure below to start the Axis2 server for the Stockquote service that is invoked by the client in this scenario.

  1. Issue the following command from the <EI_HOME>/samples/axis2Server/src/SimpleStockQuoteService directory.
    ant
  2. Issue the following command from the <EI_HOME>/samples/axis2Server directory.
    ./axis2server.sh

Step 4 - Send JSON requests

In this step, 40 requests are sent to the Stockquote service. For the purpose of demonstrating how successful messages and message failures are illustrated in the Analytics Dashboard, 10 of the requests are sent while the Axis2 server is not running. This should generate a success rate of 75% for the StockQuoteAPI REST API.

  1. Issue the following cURL command from your terminal to invoke the StockQuoteAPI REST API and get stock quotes from the Stockquote service. Send 30 requests.

    curl -X POST http://localhost:8280/stockquote/getQuote -d '{"name":"WSO2"}' -H "Content-Type:application/json"
  2. Stop the axis2 server that you previously started.
  3. Send 10 more requests using the cURL command given above.

Step 5 - Analyze statistics

The following assumptions are made in this section because the manner in which information in the Analytics Dashboard changes depending on the time gaps between requests sent to the ESB profile, and the time gap between sending requests and viewing the Analytics Dashboard.

  • All 10 requests are sent within one hour, and the Analytics Dashboard is viewed within the same hour.
  • The activities described in this use case are the only activities you have carried out in the ESB profile during the last hour before you view the Analytics Dashboard.

Follow the procedure below to access the WSO2 EI Analytics Dashboard and analyze the ESB profile statistics published in it.

  1. Log into the Management Console of the Analytics profile using the following URL:
    URL: https://<EI_Analytics_HOST>:<EI_Analytics_PORT>/carbon/
  2. In the Main tab, click Analytics Dashboard. Then log into the Analytics Dashboard by entering admin as both the username and the password. This opens the Dashboards page where the ESB Analytics dashboard is displayed as follows.
  3. Click View to open the dashboard. Then click Last Hour. The following is displayed.
    • The request count is displayed as 40. The success rate of 75% is displayed because out of the 40 requests, only 30 were sent while the axis2 server for the Stockquote service was running.
    • The number of transactions handled by the ESB per second is mapped on a graph as follows.
    • The success rate and the failure rate of the messages received by the ESB profile during the last hour are mapped in a graph as follows.
    • The StockQuoteAPI REST API is displayed under TOP APIS BY REQUEST COUNT as follows.
  4. In the Top APIS BY Request COUNT gadget, click StockquoteAPI to open the OVERVIEW/API/STOCKQUOTEAPI page. The following is displayed.
    • The API REQUEST COUNT gadget shows the total number of requests handled by the StockQuoteAPI REST API during the last hour as 40. The success rate is displayed as 75% because only 30 out of the 40 requests were sent while the axis2 server was running.
    • The MESSAGE COUNT gadget maps the number of successful messages as well as failed messages at different times within the last hour in a graph as shown below.
       
    • The MESSAGE LATENCY gadget shows the speed with which the messages are processed by mapping the amount of time taken per message at different times within the last hour as shown below.
       
    • The MESSAGES gadget lists all the the messages handled by the StockQuoteAPI REST API during the last hour with the following property details as follows.

      PropertyDescription
      Message IDUnique ID to identify a request
      HostIP address of the ESB profile runtime instance, which receives the actual request
      Start TimeThe time when the request reached the Synapse mediation engine
      StatusIf the flow of request is successfully completed or not

       

    • The MESSAGE FLOW gadget illustrates the order in which the messages handled by the StockQuoteAPI REST API within the last hour passed through all the mediation sequences, mediators and endpoints that were included in the message flow as shown below.
       
  5. Click on a message ID in the MESSAGES gadget to open the OVERVIEW/MESSAGE/<MESSAGE_ID> page. The following is displayed.
    • The MESSAGE FLOW gadget illustrates the order in which the messages handled by the StockQuoteAPI REST API within the last hour passed through all the mediation sequences, mediators and endpoints that were included in the message flow as shown below.
       
    • Click PayloadFactoryMediator in the MESSAGE FLOW gadget. As a result, the MEDIATOR PROPERTIES gadget illustrates the processing carried out by the Payload Factory mediator selected by displaying the payload, transport properties and context properties in the message flow both before the mediator and after the mediator as shown below.
       
  • No labels