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 15:50:22 UTC

svn commit: r1053902 - in /synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide: samples.xml samples/sample410.xml samples/sample700.xml samples/setup/

Author: hiranya
Date: Thu Dec 30 14:50:21 2010
New Revision: 1053902

URL: http://svn.apache.org/viewvc?rev=1053902&view=rev
Log:
Tx mediator and DLC


Added:
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample410.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/setup/
Modified:
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
    synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample700.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=1053902&r1=1053901&r2=1053902&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 14:50:21 2010
@@ -176,6 +176,12 @@
                         <li><a href="samples/sample400.html">Sample 400: Message splitting and aggregation</a></li>
                     </ul>
                 </p>
+                <h4>Transaction Mediator</h4>
+                <p>
+                    <ul>
+                        <li><a href="samples/sample410.html">Sample 410: Distributed transactions management with the transaction mediator</a></li>
+                    </ul>
+                </p>
                 <h4>Cache Mediator</h4>
                 <p>
                     <ul>
@@ -225,7 +231,6 @@
                     <ul>
                         <li><a href="samples/sample650.html">Sample 650: Introduction to priority based mediation</a></li>
                         <li><a href="samples/sample651.html">Sample 651: Priority based dispatching at transport level</a></li>
-                        <li><a href="samples/sample652.html">Sample 652: Distributed transactions management</a></li>
                     </ul>
                 </p>
             </subsection>

Added: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample410.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample410.xml?rev=1053902&view=auto
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample410.xml (added)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample410.xml Thu Dec 30 14:50:21 2010
@@ -0,0 +1,141 @@
+<?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 410</title>
+    </properties>
+    <body>
+        <section name="Sample 410: Distributed Transactions Management with the Transaction Mediator">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://ws.apache.org/ns/synapse http://synapse.apache.org/ns/2010/04/configuration/synapse_config.xsd"&gt;
+
+    &lt;sequence name="myFaultHandler"&gt;
+        &lt;log level="custom"&gt;
+            &lt;property name="text" value="** Rollback Transaction**"/&gt;
+        &lt;/log&gt;
+        &lt;transaction action="rollback"/&gt;
+        &lt;send/&gt;
+    &lt;/sequence&gt;
+
+    &lt;sequence name="main" onError="myFaultHandler"&gt;
+        &lt;in&gt;
+            &lt;send&gt;
+                &lt;endpoint&gt;
+                    &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+                &lt;/endpoint&gt;
+            &lt;/send&gt;
+        &lt;/in&gt;
+
+        &lt;out&gt;
+            &lt;transaction action="new"/&gt;
+
+            &lt;log level="custom"&gt;
+                &lt;property name="text" value="** Reporting to the Database esbdb**"/&gt;
+            &lt;/log&gt;
+            &lt;dbreport useTransaction="true" xmlns="http://ws.apache.org/ns/synapse"&gt;
+                &lt;connection&gt;
+                    &lt;pool&gt;
+                        &lt;dsName&gt;java:jdbc/XADerbyDS&lt;/dsName&gt;
+                        &lt;icClass&gt;org.jnp.interfaces.NamingContextFactory&lt;/icClass&gt;
+                        &lt;url&gt;localhost:1099&lt;/url&gt;
+                        &lt;user&gt;synapse&lt;/user&gt;
+                        &lt;password&gt;synapse&lt;/password&gt;
+                    &lt;/pool&gt;
+                &lt;/connection&gt;
+                &lt;statement&gt;
+                    &lt;sql&gt;delete from company where name =?&lt;/sql&gt;
+                    &lt;parameter expression="//m0:return/m1:symbol/child::text()"
+                               xmlns:m0="http://services.samples"
+                               xmlns:m1="http://services.samples/xsd"
+                               type="VARCHAR"/&gt;
+                &lt;/statement&gt;
+            &lt;/dbreport&gt;
+
+            &lt;log level="custom"&gt;
+                &lt;property name="text" value="** Reporting to the Database esbdb1**"/&gt;
+            &lt;/log&gt;
+            &lt;dbreport useTransaction="true" xmlns="http://ws.apache.org/ns/synapse"&gt;
+                &lt;connection&gt;
+                    &lt;pool&gt;
+                        &lt;dsName&gt;java:jdbc/XADerbyDS1&lt;/dsName&gt;
+                        &lt;icClass&gt;org.jnp.interfaces.NamingContextFactory&lt;/icClass&gt;
+                        &lt;url&gt;localhost:1099&lt;/url&gt;
+                        &lt;user&gt;synapse&lt;/user&gt;
+                        &lt;password&gt;synapse&lt;/password&gt;
+                    &lt;/pool&gt;
+                &lt;/connection&gt;
+                &lt;statement&gt;
+                    &lt;sql&gt;INSERT into company values ('IBM','c4',12.0)&lt;/sql&gt;
+                &lt;/statement&gt;
+            &lt;/dbreport&gt;
+            &lt;transaction action="commit"/&gt;
+            &lt;send/&gt;
+        &lt;/out&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate how to manage complex distributed transactions using the transaction
+                    mediator
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            To run this sample it is required to deploy Synpase on JBoss application
+                            server(This is only tested with JBoss application sever). You can use the
+                            Synapse war distribution to deploy Synapse on JBoss. Use the synpase_sample_410.xml
+                            as the synapse confiuration file and start JBoss. Also you need to define
+                            two XA datasources for above the two datasources defined in Synapse. You'll
+                            need to refer JBoss documentation to see how to do this.
+                        </li>
+                        <li>
+                            Setup two Derby database instances as described in the database setup guide.
+                            These databases will be used by the XA datasources in JBoss.
+                        </li>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    In this sample a record is deleted from one database and it is added to the
+                    second database. If either of the operations(deleting from the 1st database and
+                    adding to the second database) fails the entire operation will be roll backed.
+                    The records will be left intact.
+                </p>
+                <p>
+                    Invoke the client as follows to try this out.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=SUN</div>
+                <p>
+                    You can force an error by shutting down one of the two database instances.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>
+    </body>
+</document>
\ No newline at end of file

Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample700.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample700.xml?rev=1053902&r1=1053901&r2=1053902&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample700.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample700.xml Thu Dec 30 14:50:21 2010
@@ -23,7 +23,7 @@
         <title>Apache Synapse - Sample 700</title>
     </properties>
     <body>
-        <section name="Sample 700: ">
+        <section name="Sample 700: Introduction to Synapse Message Store">
             <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
     &lt;!--Simple in Memory Message Store with name foo --&gt;
     &lt;messageStore name="foo" sequence="bar"&gt;
@@ -58,7 +58,8 @@
 &lt;/definitions&gt;</div>
             <subsection name="Objective">
                 <p>
-
+                    Demonstrate the usage of Synapse message stores and how to use a message store
+                    to implement the popular 'Dead Letter Channel' integration pattern
                 </p>
             </subsection>
             <subsection name="Pre-requisites">
@@ -78,11 +79,22 @@
                 </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>
+                    First execute the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/soap/StockQuote</div>
+                <p>
+                    Since you have the sample Axis2 server running, you will get a stock quote response
+                    at the client side. Axis2 server will also print a log confirming the generation
+                    of a new quote value. Now shut the Axis2 server down and invoke the sample client
+                    again. Now Synapse will attempt twice to deliever the message and faling that, the
+                    message will be stored in the specified in-memory message store (dead letter channel)
+                    for later delivery.
+                </p>
+                <p>
+                    Now you can use the JMX view of the Synapse message store to see the message
+                    stored in the dead letter channel and manually retry on them.
+                </p>                
             </subsection>
         </section>
         <p><a href="../samples.html">Back to Catalog</a></p>