You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ra...@apache.org on 2010/09/20 12:19:23 UTC
svn commit: r998866 - in /synapse/trunk/java/src/site/xdoc:
Synapse_Configuration_Language.xml Synapse_Samples.xml
Author: rajikak
Date: Mon Sep 20 10:19:22 2010
New Revision: 998866
URL: http://svn.apache.org/viewvc?rev=998866&view=rev
Log:
Added sample #652 docs.
Modified:
synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml
synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml
Modified: synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml?rev=998866&r1=998865&r2=998866&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Configuration_Language.xml Mon Sep 20 10:19:22 2010
@@ -1073,7 +1073,8 @@ where "sequence/dynamic_seq_1.xml" refer
</p>
<pre xml:space="preserve">
<a href="#send">send</a> | <a href="#drop">drop</a> | <a href="#log">log</a> | <a href="#property">property</a> | <a href="#sequence_ref">sequence</a> | <a href="#validate">validate</a> | <a href="#Callout">Callout</a> | <a href="#makefault">makefault</a> | <a href="#xslt">xslt</a> | <a href="#xquery">xquery</a> | <a href="#rewrite">rewrite</a> | <a href="#header">header</a> | <a href="#filter">filter</a> | <a href="#switch">switch</a> | <a href="#in">in</a> | <a href="#out">out</a>
- | <a href="#dblookup">dblookup</a> | <a href="#dbreport">dbreport</a> | <a href="#throttle">throttle</a> | <a href="#cache">cache</a> | <a href="#clone">clone</a> | <a href="#iterate">iterate</a> | <a href="#aggregate">aggregate</a> | <a href="#class">class</a> | <a href="#pojoCommand">pojoCommand</a> | <a href="#spring">spring</a> | <a href="#script">script</a> | <a href="#RMSequence">RMSequence</a> | <a href="#eventPublisher">eventPublisher</a>
+ | <a href="#dblookup">dblookup</a> | <a href="#dbreport">dbreport</a> | <a href="#throttle">throttle</a> | <a href="#cache">cache</a> | <a href="#clone">clone</a> | <a href="#iterate">iterate</a> | <a href="#aggregate">aggregate</a> | <a href="#class">class</a> | <a href="#pojoCommand">pojoCommand</a> | <a href="#spring">spring</a> | <a href="#script">script</a> | <a href="#RMSequence">RMSequence</a> | <a href="#eventPublisher">eventPublisher</a> | <a href="#transaction">transaction</a>
+
</pre>
<p>
In addition to the above, Synapse will be able to load custom mediators
@@ -2155,8 +2156,7 @@ where "sequence/dynamic_seq_1.xml" refer
should be specified. With the version attribute the WS-RM specification
version to be used can be specified, 1.0 or 1.1.
</p>
- </h3>
- <h4>
+ <h4>
<a name="eventPublisher" id="eventPublisher">eventPublisher</a>
</h4>
<pre xml:space="preserve"> <eventPublisher eventSourceName="string"/></pre>
@@ -2171,7 +2171,35 @@ where "sequence/dynamic_seq_1.xml" refer
mediators using sequences before the eventPublisher mediator. Quality of service like security
can add to the events by applying QOS to the proxy service that holds the eventPublisher mediator.
</p>
- <p/>
+
+ <h4>
+ <a name="transaction" id="transaction">Transaction</a>
+ </h4>
+ <pre xml:space="preserve">
+ <transaction
+ action="new|use-existing-or-new|fault-if-no-tx|commit|rollback|suspend|resume">
+ </transaction>
+ </pre>
+ <p>The action attribute has the following meanings.</p>
+ <p>1. new - Create a new jta transaction. Generate a fault if a transaction already exist.
+ </p>
+ <p>2. use-existing-or-new - Create a new jta transaction. Do nothing if a transaction exist.
+ </p>
+ <p>3. fault-if-no-tx - Generate a fault if no transaction exist. Do nothing if a transaction
+ exist.
+ </p>
+ <p>4. commit - Commit transaction. Generate a fault if no transaction exist.</p>
+ <p>5. rollback - Rollback transaction. Generate a fault if no transaction exist.</p>
+ <p>6. suspend - Suspend transaction. Generate a fault if no transaction exist.</p>
+ <p>7. resume - Resume transaction. Generate a fault if no transaction exist.</p>
+
+ <p>
+ The transaction mediator can use to define a distributed transaction. It has the
+ transaction markers which can be used to mark the start and end of
+ a transaction. Transaction mediator required a JTA provider in the system to work.
+ </p>
+
+ <p/>
<p/>
</body>
</document>
Modified: synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml?rev=998866&r1=998865&r2=998866&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml Mon Sep 20 10:19:22 2010
@@ -340,6 +340,9 @@
<li>
<a href="#Sample651">Sample 651: NHTTP Transport Priority based dispatching</a>
</li>
+ <li>
+ <a href="#Sample652">Sample 652: Distributed transaction management</a>
+ </li>
</ul>
</li>
</ul></div>
@@ -5154,4 +5157,113 @@ values by executing XPath expressions. T
</soapenv:Envelope>
</pre>
</div>
+ <h2>
+ <a name="Sample652" id="Sample652">Distributed transaction with Transaction
+ mediator
+ </a>
+ </h2>
+ <p>This sample describes how to use transaction mediator to participate in a distributed
+ transaction
+ </p>
+ <h2>
+ <a name="Sample652" id="Sample652">Sample 652: Distributed transaction management</a>
+ </h2>
+ <pre xml:space="preserve"> <definitions xmlns="http://synapse.apache.org/ns/2010/04/configuration">
+
+ <sequence name="myFaultHandler">
+ <log level="custom">
+ <property name="text" value="** Rollback Transaction**"/>
+ </log>
+ <transaction action="rollback"/>
+ <send/>
+ </sequence>
+
+ <sequence name="main" onError="myFaultHandler">
+ <in>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </in>
+
+ <out>
+ <transaction action="new"/>
+
+ <log level="custom">
+ <property name="text" value="** Reporting to the Database esbdb**"/>
+ </log>
+ <dbreport useTransaction="true" xmlns="http://ws.apache.org/ns/synapse">
+ <connection>
+ <pool>
+ <dsName>java:jdbc/XADerbyDS</dsName>
+ <icClass>org.jnp.interfaces.NamingContextFactory</icClass>
+ <url>localhost:1099</url>
+ <user>synapse</user>
+ <password>synapse</password>
+ </pool>
+ </connection>
+ <statement>
+ <sql>delete from company where name =?</sql>
+ <parameter expression="//m0:return/m1:symbol/child::text()"
+ xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd"
+ type="VARCHAR"/>
+ </statement>
+ </dbreport>
+
+ <log level="custom">
+ <property name="text" value="** Reporting to the Database esbdb1**"/>
+ </log>
+ <dbreport useTransaction="true" xmlns="http://ws.apache.org/ns/synapse">
+ <connection>
+ <pool>
+ <dsName>java:jdbc/XADerbyDS1</dsName>
+ <icClass>org.jnp.interfaces.NamingContextFactory</icClass>
+ <url>localhost:1099</url>
+ <user>synapse</user>
+ <password>synapse</password>
+ </pool>
+ </connection>
+ <statement>
+ <sql> INSERT into company values ('IBM','c4',12.0)</sql>
+ </statement>
+ </dbreport>
+ <transaction action="commit"/>
+ <send/>
+ </out>
+ </sequence>
+ </definitions> </pre>
+
+
+ <div>
+ <p>
+ <strong>Objective:</strong>
+ Demonstrate the use of the transaction mediator in a distributed transaction
+ </p>
+ <p>
+ <strong>Prerequisites:</strong>
+ Deploy the SimpleStockQuoteService in sample Axis2 server and start it on port 9000.
+ </p>
+ <p>Start Synapse with the sample configuration 652 (i.e. synapse -sample 652).</p>
+ <p>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
+ war distribution to deploy synapse on JBoss application server. Use the
+ synpase_sample_652.xml as the synapse confiuration file and start JBoss with
+ that synpase configuration file. Also you need to define two XA datasources for above
+ two datasources. You'll need to refer JBoss documentation to see how
+ to do this.
+ </p>
+ <p>It also required to have two database instances, this will be used by the two XA
+ datasources. Refer the
+ <a href="Synapse_Samples_Setup.html#derby">Sample Setup Guide</a>
+ to see how you can set up the derby database server.
+ </p>
+ <p>In this sample a record is delete from one database and it is added into the second
+ database. If either of the operations(deleting from the 1st database and adding into the
+ second database) fails everything will be roll backed. The records will be untoched.
+ </p>
+ <p>Invoke the client as follows.</p>
+ <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=SUN/
+ </pre>
+ </div>
</body></document>