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/13 20:52:26 UTC
svn commit: r1045343 - in
/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide: samples.xml
samples/sample250.xml samples/sample251.xml
Author: hiranya
Date: Mon Dec 13 19:52:25 2010
New Revision: 1045343
URL: http://svn.apache.org/viewvc?rev=1045343&view=rev
Log:
Samples 250, 251
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample250.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample251.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=1045343&r1=1045342&r2=1045343&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 Mon Dec 13 19:52:25 2010
@@ -100,8 +100,8 @@
<subsection name="Transports">
<p>
<ul>
- <li><a href="">Sample 250: Introduction to switching transports - JMS to http/s</a></li>
- <li><a href="">Sample 251: Switching from http/s to JMS</a></li>
+ <li><a href="samples/sample250.html">Sample 250: Introduction to transport switching - JMS to HTTP/S</a></li>
+ <li><a href="samples/sample251.html">Sample 251: Switching from http/s to JMS</a></li>
<li><a href="">Sample 252: Pure text/binary and POX message support with JMS</a></li>
<li><a href="">Sample 253: One way bridging from JMS to http and replying with a 202 Accepted response</a></li>
<li><a href="">Sample 254: Using the file system as transport medium using VFS transport listener and sender</a></li>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample250.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample250.xml?rev=1045343&r1=1045342&r2=1045343&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample250.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample250.xml Mon Dec 13 19:52:25 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 250</title>
</properties>
<body>
- <section name="Sample 250: ">
+ <section name="Sample 250:Introduction to Transport Switching - JMS to HTTP/S ">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="StockQuoteProxy" transports="jms">
@@ -50,7 +50,8 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the ability of Synapse to perform transport switching (i.e. receiving
+ messages over one transport and forwarding them over a different transport)
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -60,6 +61,15 @@
Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
</li>
<li>
+ Setup and start a JMS broker (Apache ActiveMQ can be used as the
+ JMS broker for this scenario. Refer JMS setup guide for information on
+ how to run ActiveMQ.)
+ </li>
+ <li>
+ Enable the JMS transport receiver of Synapse (Refer JMS setup guide for
+ more details)
+ </li>
+ <li>
Start Synapse using the configuration numbered 250 (repository/conf/sample/synapse_sample_250.xml)
<div class="command">
Unix/Linux: sh synapse.sh -sample 250<br/>
@@ -70,11 +80,52 @@
</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 we are using a proxy service exposed over JMS (note the transports=jms
+ attribute). If you check the WSDL of the proxy service using a web browser you
+ will notice that it only has JMS endpoints.
+ </p>
+ <p>
+ Run the sample JMS client by switching to the samples/axis2Client directory and
+ executing the following command.
+ </p>
+ <div class="command">ant jmsclient -Djms_type=pox -Djms_dest=dynamicQueues/StockQuoteProxy -Djms_payload=MSFT</div>
+ <p>
+ This will send a plain XML formatted place order request to a JMS queue named
+ 'StockQuoteProxy'. Synapse will be polling on this queue for any incoming messages
+ so it will pick up the request. If you run Synapse in the DEBUG mode, following
+ entry will be printed on the console.
+ </p>
+ <div class="consoleOutput">[JMSWorker-1] DEBUG ProxyServiceMessageReceiver -Proxy Service StockQuoteProxy received a new message...</div>
+ <p>
+ Then Synapse will mediate the request through the service bus and forward it to
+ the sample Axis2 server over HTTP. Axis2 server will print the following entry
+ on the console when it receives the request.
+ </p>
+ <div class="consoleOutput">Accepted order for : 16517 stocks of MSFT at $ 169.14622538721846</div>
+ <p>
+ Note that the operation is out-only and no response is sent back to the client.
+ The transport.jms.ContentType property is necessary to allow the JMS transport
+ to determine the content type of incoming messages. With the given configuration
+ it will first try to read the content type from the 'contentType' message property
+ and fall back to 'application/xml' (i.e. POX) if this property is not set. Note
+ that the JMS client used in this example doesn't send any content type
+ information.
+ </p>
+ <p>
+ It is also important to note that the name of the source JMS queue is same as the
+ name of the proxy service (StockQuoteProxy). This is the default behavior of
+ Synapse. Each proxy service by default listens on a JMS queue which has the same
+ name as the service. It is possible to instruct a JMS proxy service to listen to
+ an already existing destination without creating a new one. To do this, use the
+ parameter elements on the proxy service definition to specify the destination
+ and connection factory information. An example is given below.
+ </p>
+ <div class="xmlConf"><parameter name="transport.jms.Destination">dynamicTopics/something.TestTopic</parameter></div>
+ <p>
+ With the above parameter in the proxy configuration, proxy service will listen
+ on a JMS topic named 'something.TestTopic' for incoming requests.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample251.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample251.xml?rev=1045343&r1=1045342&r2=1045343&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample251.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample251.xml Mon Dec 13 19:52:25 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 251</title>
</properties>
<body>
- <section name="Sample 251: ">
+ <section name="Sample 251: Switching from HTTP/S to JMS">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="StockQuoteProxy" transports="http">
@@ -45,14 +45,25 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ This sample demonstrates receiving messages over HTTP/S and forwarding them to
+ a JMS queue
</p>
</subsection>
<subsection name="Pre-requisites">
<p>
<ul>
<li>
- Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ Setup and start a JMS broker (Apache ActiveMQ can be used as the
+ JMS broker for this scenario. Refer JMS setup guide for information on
+ how to run ActiveMQ.)
+ </li>
+ <li>
+ Enable the JMS transport receiver of the sample Axis2 server (Refer JMS
+ setup guide for details)
+ </li>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 (Since
+ the JMS receiver is enabled, Axis2 will start polling on a JMS queue)
</li>
<li>
Start Synapse using the configuration numbered 251 (repository/conf/sample/synapse_sample_251.xml)
@@ -65,11 +76,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>
+ This Synapse configuration creates a proxy service over HTTP and forwards
+ received messages to a JMS queue. To test this functionality, send a place order
+ request to Synapse over HTTP as follows.
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=placeorder -Dsymbol=MSFT</div>
+ <p>
+ Note that the target endpoint of the proxy service points to a JMS queue in the
+ ActiveMQ broker.
+ </p>
+ <div class="consoleOutput">jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=
+QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&
+java.naming.provider.url=tcp://localhost:61616</div>
+ <p>
+ The sample Axis2 server will pick up the message from the JMS queue and print the
+ following log entry.
+ </p>
+ <div class="consoleOutput">Accepted order for : 18406 stocks of MSFT at $ 83.58806051152119</div>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>