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 07:02:22 UTC
svn commit: r1053804 - in
/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide: samples.xml
samples/sample450.xml samples/sample451.xml samples/sample452.xml
samples/sample460.xml samples/sample500.xml
Author: hiranya
Date: Thu Dec 30 06:02:22 2010
New Revision: 1053804
URL: http://svn.apache.org/viewvc?rev=1053804&view=rev
Log:
URL rewrite mediator, spring mediator
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample450.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample451.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample452.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample460.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample500.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=1053804&r1=1053803&r2=1053804&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 06:02:22 2010
@@ -191,9 +191,15 @@
<h4>URL Rewrite Mediator</h4>
<p>
<ul>
- <li><a href="#Sample450">Sample 450: Introduction to the URL Rewrite mediator</a></li>
- <li><a href="#Sample451">Sample 451: Conditional URL rewriting</a></li>
- <li><a href="#Sample452">Sample 452: Conditional URL rewriting with multiple rules</a></li>
+ <li><a href="samples/sample450.html">Sample 450: Introduction to the URL Rewrite mediator</a></li>
+ <li><a href="samples/sample451.html">Sample 451: Conditional URL rewriting</a></li>
+ <li><a href="samples/sample452.html">Sample 452: Conditional URL rewriting with multiple rules</a></li>
+ </ul>
+ </p>
+ <h4>Spring Mediator</h4>
+ <p>
+ <ul>
+ <li><a href="samples/sample460.html">Sample 460: Introduction to the Spring mediator</a></li>
</ul>
</p>
</subsection>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample450.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample450.xml?rev=1053804&r1=1053803&r2=1053804&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample450.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample450.xml Thu Dec 30 06:02:22 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 450</title>
</properties>
<body>
- <section name="Sample 450: ">
+ <section name="Sample 450: Introduction to the URL Rewrite Mediator">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
@@ -43,7 +43,7 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the basic functions of the URL rewrite mediator
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -63,11 +63,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>
+ URL rewrite mediator can be used to modify the 'To' header of a request based on
+ one or more user defined URL rewrite rules. A rewrite rule could be a
+ plain rewrite instruction or a conditional instruction. In this sample we use a
+ plain, unconidtional rewrite rule which simply replaces the string 'soap' with
+ 'services' in the 'To' header.
+ </p>
+ <p>
+ Invoke the sample client as follows to try this out.
+ </p>
+ <div class="command">ant stockquote -Dtrpurl=http://localhost:8280 -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService</div>
+ <p>
+ Note that the address URL of the client request contains the context 'soap'. But
+ in the Axis2 server all the services are deployed under a context named 'services'
+ by default. Synapse will rewrite the To header of the request by replacing the
+ 'soap' context with 'services. Hence the request will be delivered to the Axis2
+ server and the Axis2 client will receive a valid response.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample451.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample451.xml?rev=1053804&r1=1053803&r2=1053804&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample451.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample451.xml Thu Dec 30 06:02:22 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 451</title>
</properties>
<body>
- <section name="Sample 451: ">
+ <section name="Sample 451: Conditional URL Rewriting">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
@@ -52,7 +52,8 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the ability of the URL rewrite mediator to evaluate conditions on
+ messages and perform rewrites based on the results
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -72,11 +73,25 @@
</p>
</subsection>
<subsection name="Executing the Client">
+ <p>
+ Invoke the Axis2 client and send some requests to Synapse with different address
+ URL values. If the address URL value contains 'localhost' as the hostname and 'https'
+ as the protocol prefix, Synapse will route the message as it is. But if the
+ hostname is 'localhost' and the protocol is not https, Synapse will rewrite the
+ URL by setting 'https' as the protocol. The port number will also be set to the
+ HTTPS port of the Axis2 server.
+ </p>
+ <p>
+ If you invoke the client as follows, Synapse will rewrite the 'To' header and
+ forward the message to Axis2 over HTTPS.
+ </p>
<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>
+ The condition evaluation feature is provided by the Synapse evaluator framework.
+ Currently one can evaluate expressions on URL values, query parameters, transport
+ headers, properties and SOAP envelope content using this framework. Hence URL
+ rewriting can be done based on any of these aspects.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample452.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample452.xml?rev=1053804&r1=1053803&r2=1053804&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample452.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample452.xml Thu Dec 30 06:02:22 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 452</title>
</properties>
<body>
- <section name="Sample 452: ">
+ <section name="Sample 452: Conditional URL Rewriting with Multiple Rules">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
@@ -59,7 +59,8 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the ability of the URL rewrite mediator to perform rewrites based
+ on multiple rules
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -79,11 +80,25 @@
</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>
+ One may specify multiple rewrite rules for a URL rewrite mediator instance. In
+ that case Synapse will execute all the rules on each message, in the order they
+ appear. This particular sample lists 3 rewrite rules. To try it out, invoke the
+ client as follows.
+ </p>
+ <div class="command">ant stockquote -Dtrpurl=http://localhost:8280 -Daddurl=http://test.com/SimpleStockQuoteService</div>
+ <p>
+ The provided address URL does not contain a port number and the context. The URL
+ rewrite mediator will replace the hostname (test.com) with 'localhost' and add the
+ context '/services' to the path. Then it will add the appropriate port number to
+ the URL by looking at the protocol prefix. Ultimately the service request will be
+ routed the sample Axis2 server and the client will receive a valid response.
+ </p>
+ <p>
+ Another important aspect shown by this sample is the ability of the URL rewirte
+ mediator to obtain the necessary values by executing XPath expressions. The port
+ numbers are calculated by executing an XPath on the messages.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample460.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample460.xml?rev=1053804&r1=1053803&r2=1053804&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample460.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample460.xml Thu Dec 30 06:02:22 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 460</title>
</properties>
<body>
- <section name="Sample 460: ">
+ <section name="Sample 460: Introduction to the Spring Mediator">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
@@ -39,9 +39,26 @@
</sequence>
</definitions></div>
+ <p>
+ This sample configuration loads an external SpringBean from a file named
+ springCustomLogger.xml. Contents of this file are as follows.
+ </p>
+ <div class="xmlConf"><?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
+ "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+
+ <bean id="springtest" class="samples.mediators.extentions.SpringCustomLogger" singleton="false">
+ <property name="userName"><value>"Synapse User"</value></property>
+ <property name="email"><value>"usr@synapse.org"</value></property>
+ </bean>
+
+</beans></div>
+
<subsection name="Objective">
<p>
-
+ Demonstrate how to initialize and use a SpringBean as a mediator
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -61,11 +78,25 @@
</p>
</subsection>
<subsection name="Executing the Client">
+ <p>
+ In this sample, the Spring Bean named 'SpringCustomLogger' gets loaded from the
+ springCustomLogger.xml file and then it is used to log the message ID of each
+ message being mediated. To see it in action, invoke the sample client as follows.
+ </p>
<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>
+ If you have enabled logging for the samples.mediators package in the log4j.properties
+ file, you will see an output similar to the following, on the console.
+ </p>
+ <div class="consoleOutput">2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Starting Spring Meditor
+2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Bean in Initialized with User:["Synapse User"]
+2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger E-MAIL:["usr@synapse.org"]
+2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Massage Id: urn:uuid:383FA8B27D7CC549D91285514217720
+2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Logged....</div>
+ <p>
+ Similarly you can import any SpringBean into the Synapse runtime using the
+ spring mediator, and use Spring to execute mediation rules.
+ </p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
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=1053804&r1=1053803&r2=1053804&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 06:02:22 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 500</title>
</properties>
<body>
- <section name="Sample 500: ">
+ <section name="Sample 500: Simple Eventing Sample">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<eventSource name="SampleEventSource">
@@ -49,7 +49,7 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the use of the Eventing functionality built into Synapse
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -69,11 +69,53 @@
</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 an event source is creted based on the provided configuration. Event
+ subscriber subscribes for the events, Event sender publishes events and the
+ SimpleStockQuoteService acts as the Event Sink.
+ </p>
+ <p>
+ First, invoke the sample client (Subscriber) as follows.
+ </p>
+ <div class="command">ant eventsubscriber</div>
+ <p>
+ This will create a new subscription with the SimpleStockQuoteService deployed on
+ the sample Axis2 server acting as the sink. Whenever a new event is published,
+ SimpleStockQuoteService will receive a message with that event. You should see a
+ message like this on the client console confirming the subscription.
+ </p>
+ <div class="consoleOutput">[java] Subscription identifier: urn:uuid:6989F66706E73C69F5259116575749162017010321</div>
+ <p>
+ You will need this identifier to modify the subscription in the next steps. Now,
+ invoke the client (Sender) as follows.
+ </p>
+ <div class="command">ant eventsender</div>
+ <p>
+ This will send a placeOrder request to the EventingProxy. You should see a
+ message in the Synapse logs. Note the presence of the following SOAP header
+ in the request.
+ </p>
+ <div class="consoleOutput"><aip:Topic xmlns:aip="http://apache.org/aip">synapse/event/test</aip:Topic></div>
+ <p>
+ Since there is a single subscription with SimpleStockQuoteService as the sink,
+ Synapse will send the message to the sample Axis2 server and you should see the
+ following message in its logs:
+ </p>
+ <div class="consoleOutput">Accepted order for : 1000 stocks of GOOG at $ 10.1</div>
+ <p>
+ You can also send various other WS-Eventing messages from the sample client to
+ modify the subscription details. To get the current status of the subscription,
+ invoke the client as follows.
+ </p>
+ <div class="command">ant eventsubscriber -Dmode=getstatus -Didentifier=<i><identifier></i></div>
+ <p>
+ To renew the subscription, invoke the client as follows.
+ </p>
+ <div class="command">ant eventsubscriber -Dmode=renew -Didentifier=<i><identifier></i> -Dexpires=2012-12-31T21:07:00.000-08:00</div>
+ <p>
+ Finally, in order to unsubscribe, use the following command.
+ </p>
+ <div class="command">ant eventsubscriber -Dmode=unsubscribe -Didentifier=<i><identifier></i></div>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>