Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <priority-executor name="exec">
        <queues>
            <queue size="100" priority="1"/>
            <queue size="100" priority="10"/>
        </queues>
    </priority-executor>
    <proxy name="StockQuoteProxy">
        <target>
            <inSequence>
                <filter source="$trp:priority" regex="1">
                    <then>
                        <enqueue priority="1" sequence="priority_sequence" executor="exec"/>
                    </then>
                    <else>
                        <enqueue priority="10" sequence="priority_sequence" executor="exec"/>
                    </else>
                </filter>
            </inSequence>
            <outSequence>
                <send/>
            </outSequence>
        </target>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
    </proxy>
    <sequence name="priority_sequence">
        <log level="full"/>
        <send>
            <endpoint>
                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
        </send>
    </sequence>
</definitions>
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 mediation it is required to use a load testing tool like JMeter, SOAP UI or Apache bench.

...