com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.

Sample 372: Use of Both Concurrency Throttling and Request-Rate-Based Throttling

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: Use of both concurrency throttling and request rate based throttling.

<!-- Use of both concurrency throttling and request rate based throttling -->
<definitions xmlns="http://ws.apache.org/ns/synapse">

    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
        <!-- the root property of the simple URL registry helps resolve a resource URL as root + key -->
        <parameter name="root">file:repository/</parameter>
        <!-- all resources loaded from the URL registry would be cached for this number of milli seconds -->
        <parameter name="cachableDuration">150000</parameter>
    </registry>

    <sequence name="onAcceptSequence">
        <log level="custom">
            <property name="text" value="**Access Accept**"/>
        </log>
        <send>
            <endpoint>
                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
        </send>
    </sequence>
    <sequence name="onRejectSequence" trace="enable">
        <log level="custom">
            <property name="text" value="**Access Denied**"/>
        </log>
        <makefault>
            <code value="tns:Receiver"
                  xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>
            <reason value="**Access Denied**"/>
        </makefault>
        <property name="RESPONSE" value="true"/>
        <header name="To" action="remove"/>
        <send/>
        <drop/>
    </sequence>
    <proxy name="StockQuoteProxy">
        <target>
             <inSequence>
                <throttle onReject="onRejectSequence" onAccept="onAcceptSequence" id="A">
                    <policy key="repository/samples/resources/policy/throttle_policy.xml"/>
                </throttle>
            </inSequence>
            <outSequence>
                <throttle id="A"/>
                <send/>
            </outSequence>
        </target>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
    </proxy>
</definitions>

Prerequisites:

  • Deploy the SimpleStockQuoteService in sample Axis2 server and start it on port 9000.
  • Start ESB with the sample configuration 372 (i.e. wso2esb-samples -sn 372).

Throttle policy is loaded from the ?throttle_policy.xml? .That policy contains merging policy from sample 370 and 371. To check the functionality , it is need to run load test. The all-enabled request from the concurrency throttling will be controlled by the access rate base throttling according to the policy.

Run the client as follows:

ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy

You will get results same as sample 371.if you run the load test, results will be different due to affect of concurrency throttling.

Extending the mediation in java (Class Mediator)

Class mediator can be used to write your own custom mediation in Java and you have access to the SynapseMessageContext and to the full Synapse API in there. This is a useful extension mechanism within ESB to extend its functionality. This class can contain fields for which you can assign values at runtime through the configuration.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.