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/29 11:01:30 UTC

svn commit: r1053592 - in /synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide: samples.xml samples/sample390.xml samples/sample391.xml samples/sample400.xml samples/sample420.xml

Author: hiranya
Date: Wed Dec 29 10:01:29 2010
New Revision: 1053592

URL: http://svn.apache.org/viewvc?rev=1053592&view=rev
Log:
xquery, caching, iterate mediators

Modified:
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample390.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample391.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample400.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample420.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=1053592&r1=1053591&r2=1053592&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 Wed Dec 29 10:01:29 2010
@@ -167,19 +167,19 @@
                 <p>
                     <ul>
                         <li><a href="#Sample390">Sample 390: Introduction to the XQuery mediator</a></li>
-                        <li><a href="#Sample391">Sample 391: How to use the data from an external XML document with in XQuery </a></li>
+                        <li><a href="#Sample391">Sample 391: Using external XML documents in the XQuery mediator</a></li>
                     </ul>
                 </p>
                 <h4>Iterate Mediator and Aggregate Mediator</h4>
                 <p>
                     <ul>
-                        <li><a href="#Sample400">Sample 400: Message splitting and aggregating the responses</a></li>
+                        <li><a href="#Sample400">Sample 400: Message splitting and aggregation</a></li>
                     </ul>
                 </p>
                 <h4>Cache Mediator</h4>
                 <p>
                     <ul>
-                        <li><a href="#Sample420">Sample 420: Simple cache implemented on Synapse for the actual service</a></li>
+                        <li><a href="#Sample420">Sample 420: Simple response caching scenario</a></li>
                     </ul>
                 </p>
                 <h4>Callout Mediator</h4>

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample390.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample390.xml?rev=1053592&r1=1053591&r2=1053592&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample390.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample390.xml Wed Dec 29 10:01:29 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 390</title>
     </properties>
     <body>
-        <section name="Sample 390: ">
+        <section name="Sample 390: Introduction to the XQuery Mediator">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;!-- the SimpleURLRegistry allows access to a URL based registry (e.g. file:/// or http://) --&gt;
@@ -72,7 +72,7 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Demonstrate how to use the XQuery mediator for message content transformations
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -92,11 +92,21 @@
                 </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>
+                    This example uses the XQuery mediator to perform transformations. This sample
+                    behaves the same as <a href="sample8.html">sample 8</a> and the only difference
+                    is that this sample uses XQuery instead of XSLT for transformation.
+                </p>
+                <p>
+                    Send a custom quote request to Synapse as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=customquote</div>
+                <p>
+                    Request is transformed into a standard stock quote request by the XPery mediator.
+                    The XQuery definition is loaded through a local entry. The response from Axis2
+                    is transformed back to a custom quote response. In this case the XQuery definition
+                    is loaded from the registry.
+                </p>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample391.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample391.xml?rev=1053592&r1=1053591&r2=1053592&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample391.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample391.xml Wed Dec 29 10:01:29 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 391</title>
     </properties>
     <body>
-        <section name="Sample 391: ">
+        <section name="Sample 391: Using External XML Documents in the XQuery Mediator">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;!-- the SimpleURLRegistry allows access to a URL based registry (e.g. file:/// or http://) --&gt;
@@ -59,7 +59,8 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Demonstrate how to import external XML documents into the XQuery engine using
+                    the XQuery mediator
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -79,11 +80,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, data from commission.xml file is used inside XQuery. The stock
+                    quote price from the response and commission from the commission.xml document
+                    will be added and given as a new price value.
+                </p>
+                <p>
+                    Try out this sample by invoking the proxy service as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy</div>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample400.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample400.xml?rev=1053592&r1=1053591&r2=1053592&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample400.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample400.xml Wed Dec 29 10:01:29 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 400</title>
     </properties>
     <body>
-        <section name="Sample 400: ">
+        <section name="Sample 400: Message Splitting and Aggregation">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;proxy name="SplitAggregateProxy"&gt;
@@ -57,7 +57,9 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Showcase how Synapse can be used to split a message into multiple fragments
+                    using the iterate mediator, and process them separately. The sample also shows
+                    how to use the aggregate mediator to combine multiple messages into one.
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -77,11 +79,24 @@
                 </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 message sent to Synapse is comprised of a number of elements
+                    of the same type. When Synapse receives this message it will iterate through those
+                    elements and then will send each of them to the specified endpoint as separate
+                    messages. When all the responses are received by Synapse, those messages will be
+                    aggregated to form the resultant response and will send back to the client.
+                </p>
+                <p>
+                    To try this out invoke the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/SplitAggregateProxy -Ditr=4</div>
+                <p>
+                    The above command will send a request containing four fragments in it. The
+                    iterate mediator therefore will break up the message into four. You will notice
+                    that Axis2 server is receiving 4 requests from Synapse. Four responses from Axis2
+                    will be combined into one by the aggregate mediator and sent back to the sample
+                    Axis2 client.
+                </p>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>        

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample420.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample420.xml?rev=1053592&r1=1053591&r2=1053592&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample420.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample420.xml Wed Dec 29 10:01:29 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 420</title>
     </properties>
     <body>
-        <section name="Sample 420: ">
+        <section name="Sample 420: Simple Response Caching Scenario">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;sequence name="main"&gt;
@@ -47,7 +47,8 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Showcase the caching capabilities of Synapse by implementing a simple response
+                    cache in Synapse for an actual service deployed on Axis2
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -67,11 +68,26 @@
                 </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 message sent to Synapse is checked for an existing cached
+                    response by calculating the hash value of the request. If there is a cache hit
+                    in Synapse, then this request will not be forwarded to the actual service. Rather,
+                    Synapse responds to the client with the cached response. In case of a cache miss
+                    that particular message will be forwarded to the actual service and caches that
+                    response in the out path for the use of consecutive requests of the same type. 
+                </p>
+                <p>
+                    To try out this scenario, send a request from the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/</div>
+                <p>
+                    You will notice that if you send more than one requests within 20 seconds, only
+                    the first request is forwarded to the actual service, and the rest of the requests
+                    will be served by the cache inside Synapse. You could observe this by looking at
+                    the logs printed by the Axis2 server, as well as by observing a constant quote value in
+                    the response to the client instead of the random rate, which changes by each and
+                    every 20 seconds.
+                </p>
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>