This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
Skip to end of metadata
Go to start of metadata

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation :

  • <PRODUCT_HOME>/ repository/samples/ directory that includes all Integration profile samples is changed to <EI_HOME>/ samples/service-bus/.
  • <PRODUCT_HOME>/ repository/samples/resources/ directory that includes all artifacts related to the Integration profile samples is changed to <EI_HOME>/ samples/service-bus/resources/.

Objective: Demonstrate the priority based dispatching of NHTTP transport.

<priorityConfiguration>
    <priority-executor>
        <!-- two priorities specified with priority 10 and 1. Both priority messages has a queue depth of 100 -->
        <queues isFixedCapacity="true" nextQueue="org.apache.synapse.commons.executors.PRRNextQueueAlgorithm">
            <queue size="100" priority="10"/>
            <queue size="100" priority="1"/>
        </queues>
        <!-- these are the default values, values are put here to show their availability -->
        <threads core="20" max="100" keep-alive="5"/>
    </priority-executor>
    <!-- if a message comes that we cannot determine priority, we set a default priority of 1 -->
    <conditions defaultPriority="1">
        <condition priority="10">
            <!-- check for the header named priority -->
            <equal type="header" source="priority" value="5"/>
        </condition>
        <condition priority="1">
            <equal type="header" source="priority" value="1"/>
        </condition>
    </conditions>
</priorityConfiguration>

Prerequisites:

  • Deploy the SimpleStockQuoteService in sample Axis2 server and start it on port 9000. Priority is applied only when ESB is loaded with enough messages to consume its core number of threads. So to observe the priority based dispatching it is required to use a load testing tool like JMeter, SOAP UI or Apache bench.
  • Open axis2.xml in <EI_HOME>/conf directory and uncomment the following parameter to the configuration priorityConfigFile. Set the value to <EI_HOME>/samples/resources/priority/priority-configuration.xml.
  • Start ESB with the sample configuration 150: wso2esb-samples.sh -sn 150

In this sample, client should send a HTTP header that specifies the priority of the message. This header name is "priority". This header is retrieved in the priority configuration. Then it is matched against the value 1 and 10. Depending on this value message is executed with priority 1 or 10. Messages with smaller priority number will get higher priority.

Here are two sample XML files that can be used to invoke the service using a tool like JMeter, or Apache Ab. For SOAP user interface, the user can use the WSDL <EI_HOME>/conf/sample/resources/proxy/sample_proxy_1.wsdl to create the request. The only difference between the two requests demonstrated here is the symbol. One has the symbol as IBM and other has MSFT. For one type of request set the priority header to 1 and for the next set the priority header to 10. Then load ESB with high volume of traffic from both types of requests using the load testing tool. It prints the symbol of the incoming requests in the back end server. User should be able to see more of high priority symbol.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
     <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://localhost:8281/services/SimpleStockQuoteService</wsa:To>
        <wsa:MessageID>urn:uuid:1B57D0B0BF770678DE1261165228620</wsa:MessageID>
        <wsa:Action>urn:getQuote</wsa:Action>
     </soapenv:Header>
     <soapenv:Body>
        <m0:getQuote xmlns:m0="http://services.samples">
           <m0:request>
              <m0:symbol>IBM</m0:symbol>
           </m0:request>
        </m0:getQuote>
     </soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
     <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://localhost:8281/services/SimpleStockQuoteService</wsa:To>
        <wsa:MessageID>urn:uuid:1B57D0B0BF770678DE1261165228620</wsa:MessageID>
        <wsa:Action>urn:getQuote</wsa:Action>
     </soapenv:Header>
     <soapenv:Body>
        <m0:getQuote xmlns:m0="http://services.samples">
           <m0:request>
              <m0:symbol>MSFT</m0:symbol>
           </m0:request>
        </m0:getQuote>
     </soapenv:Body>
</soapenv:Envelope>

  • No labels