You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2010/12/30 10:03:52 UTC
svn commit: r1053829 - in
/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide: samples.xml
samples/sample500.xml samples/sample501.xml samples/sample502.xml
samples/sample650.xml samples/sample651.xml
Author: hiranya
Date: Thu Dec 30 09:03:52 2010
New Revision: 1053829
URL: http://svn.apache.org/viewvc?rev=1053829&view=rev
Log:
Eventing and priority mediation samples
Added:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample651.xml
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample500.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample501.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample502.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample650.xml
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml?rev=1053829&r1=1053828&r2=1053829&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml Thu Dec 30 09:03:52 2010
@@ -207,8 +207,8 @@
<p>
<ul>
<li><a href="">Sample 500: Introduction to Eventing</a></li>
- <li><a href="">Sample 501: EventSource with static subscriptions</a></li>
- <li><a href="">Sample 502: Transform events before publish</a></li>
+ <li><a href="">Sample 501: Event source with static subscriptions</a></li>
+ <li><a href="">Sample 502: Transforming events before publish</a></li>
</ul>
</p>
</subsection>
@@ -223,16 +223,16 @@
<subsection name="Priority Based Mediation">
<p>
<ul>
- <li><a href="#Sample650">Sample 650: Priority based Mediation</a></li>
- <li><a href="#Sample651">Sample 651: NHTTP Transport Priority based dispatching</a></li>
- <li><a href="#Sample652">Sample 652: Distributed transaction management</a></li>
+ <li><a href="#Sample650">Sample 650: Introduction to priority based mediation</a></li>
+ <li><a href="#Sample651">Sample 651: Priority based dispatching at transport level</a></li>
+ <li><a href="#Sample652">Sample 652: Distributed transactions management</a></li>
</ul>
</p>
</subsection>
<subsection name="Message Store and Dead Letter Channel">
<p>
<ul>
- <li><a href="#Sample700">Sample 700: Introduction to Synapse Message Store </a></li>
+ <li><a href="#Sample700">Sample 700: Introduction to Synapse message store </a></li>
</ul>
</p>
</subsection>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample500.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample500.xml?rev=1053829&r1=1053828&r2=1053829&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample500.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample500.xml Thu Dec 30 09:03:52 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 500</title>
</properties>
<body>
- <section name="Sample 500: Simple Eventing Sample">
+ <section name="Sample 500: Introduction to Eventing">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<eventSource name="SampleEventSource">
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample501.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample501.xml?rev=1053829&r1=1053828&r2=1053829&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample501.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample501.xml Thu Dec 30 09:03:52 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 501</title>
</properties>
<body>
- <section name="Sample 501: ">
+ <section name="Sample 501: Event Source with Static Subscriptions">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<eventSource name="SampleEventSource">
@@ -64,7 +64,7 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Showcase how to use a predefined set of static subscriptions with Synapse
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -84,11 +84,16 @@
</p>
</subsection>
<subsection name="Executing the Client">
- <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
-
- <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</div>
-
- <div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
+ <p>
+ In this sample configuration, two static subscriptions are created by providing the
+ SimpleStockQuoteService as the event sink. To try this out, invoke the sample
+ client as follows.
+ </p>
+ <div class="command">ant eventsender</div>
+ <p>
+ Events will be mediated and sent to the sample Axis2 server as operated by the
+ two static subscriptions.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample502.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample502.xml?rev=1053829&r1=1053828&r2=1053829&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample502.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample502.xml Thu Dec 30 09:03:52 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 502</title>
</properties>
<body>
- <section name="Sample 502: ">
+ <section name="Sample 502: Transforming Events Before Publish">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<eventSource name="SampleEventSource">
@@ -61,7 +61,8 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate how to mediate and transform events before they are sent to the
+ target event sinks
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -81,11 +82,15 @@
</p>
</subsection>
<subsection name="Executing the Client">
- <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
-
- <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</div>
-
- <div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
+ <p>
+ In this sample, the event (order request) is transformed into a new order with
+ a different namesapce using the XSLT mediator. Invoke the client as follows.
+ </p>
+ <div class="command">ant eventsender</div>
+ <p>
+ Event will be mediated through the 'PublicEventSource' sequence and get transformed
+ before it gets published to the event sink (Axis2 server).
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample650.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample650.xml?rev=1053829&r1=1053828&r2=1053829&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample650.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample650.xml Thu Dec 30 09:03:52 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 650</title>
</properties>
<body>
- <section name="Sample 650: ">
+ <section name="Sample 650: Introduction to Priority Based Mediation">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<priorityExecutor name="exec">
@@ -64,7 +64,8 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the usage of priority executors in Synapse to assign priority levels
+ to requests and mediate them based on the assigned priority
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -84,11 +85,61 @@
</p>
</subsection>
<subsection name="Executing the Client">
- <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
-
- <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</div>
-
- <div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
+ <p>
+ Priority is applied only when synapse is loaded with enough messages to consume
+ all of its core worker threads. So to observe the priority based mediation, it is
+ required to use a load testing tool like JMeter, SOAP UI or Apache bench.
+ </p>
+ <p>
+ 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 synapse
+ configuration using the $trp:priority XPath expression. Then it is matched against
+ the value 1. If it has the value 1, message is executed with priority 1. Otherwise
+ the message is executed with priority 10.
+ </p>
+ <p>
+ Messages with different priorities are put into different priority queues. Then they
+ are mediated in a manner so that high priority messages are always processed first.
+ </p>
+ <p>
+ Here are two sample SOAP requests that can be used to invoke the service using a
+ tool like JMeter, or Apache Bench. For SOAP UI, user can use the WSDL
+ repository/conf/sample/resources/proxy/sample_proxy_1.wsdl to create the request.
+ The only difference between the two requests shown here is the symbol. One
+ has the symbol as IBM and other has MSFT. For one type of requests set the priority
+ header to 1 and for the next set the priority header to 10. Then load Synapse with
+ a large volume of traffic consisting of both types of requests using the load testing tool.
+ Back end Axis2 server prints the symbol of the incoming requests. User should be
+ able to see more of the high priority symbol.
+ </p>
+ <div class="xmlConf"><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></div>
+ <div class="xmlConf"><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></div>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Added: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample651.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample651.xml?rev=1053829&view=auto
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample651.xml (added)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample651.xml Thu Dec 30 09:03:52 2010
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 651</title>
+ </properties>
+ <body>
+ <section name="Sample 651: Priority Based Dispatching at Transport Level">
+ <p>
+ For this sample we will be using the same Synapse configuration used in
+ <a href="sample150.html">sample 150</a>. In addition we will be using the following
+ priority configuration for the Synapse NHTTP transport.
+ </p>
+ <div class="xmlConf"><priorityConfiguration>
+ <priorityExecutor>
+ <!-- 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"/>
+ </priorityExecutor>
+
+ <!-- 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></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate priority based dispatching capabilities of the Synapse NHTTP
+ transport
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Open axis2.xml file in repository/conf directory and uncomment the
+ following parameter in the NHTTP transport receiver configuration.
+ <br/><strong>priorityConfigFile</strong>
+ <br/>Set the value to repository/conf/sample/resources/priority/priority-configuration.xml
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 150 (repository/conf/sample/synapse_sample_150.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 150<br/>
+ Windows: synapse.bat -sample 150
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ Priority is applied only when synapse is loaded with enough messages to consume
+ all of its core worker threads. So to observe the priority based mediation, it is
+ required to use a load testing tool like JMeter, SOAP UI or Apache bench.
+ </p>
+ <p>
+ 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 synapse
+ configuration using the $trp:priority XPath expression. Then it is matched against
+ the value 1. If it has the value 1, message is executed with priority 1. Otherwise
+ the message is executed with priority 10.
+ </p>
+ <p>
+ Messages with different priorities are put into different priority queues. Then they
+ are mediated in a manner so that high priority messages are always processed first.
+ </p>
+ <p>
+ Here are two sample SOAP requests that can be used to invoke the service using a
+ tool like JMeter, or Apache Bench. For SOAP UI, user can use the WSDL
+ repository/conf/sample/resources/proxy/sample_proxy_1.wsdl to create the request.
+ The only difference between the two requests shown here is the symbol. One
+ has the symbol as IBM and other has MSFT. For one type of requests set the priority
+ header to 1 and for the next set the priority header to 10. Then load Synapse with
+ a large volume of traffic consisting of both types of requests using the load testing tool.
+ Back end Axis2 server prints the symbol of the incoming requests. User should be
+ able to see more of the high priority symbol.
+ </p>
+ <div class="xmlConf"><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></div>
+ <div class="xmlConf"><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></div>
+ <p>
+ In this sample, priority based mediation takes place at the transport level
+ itself (before the message is even received by the mediation engine). High
+ priority messages will reach the service bus first.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file