You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by as...@apache.org on 2008/12/31 21:26:51 UTC

svn commit: r730466 [3/3] - in /synapse/trunk/java: ./ modules/core/src/main/java/org/apache/synapse/config/ modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core/src/main/java/org/apache/synapse/config/xml/eventing/ modules/core/src/m...

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=730466&r1=730465&r2=730466&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml Wed Dec 31 12:26:49 2008
@@ -288,7 +288,22 @@
 <a href="#Callout">Synchronize web service invocation with Callout mediator</a>
 <ul>
 <li>
-<a href="#Sample430">Sample 430: Simple Callout Mediator for synchronize web service invocation</a></li></ul></li></ul></li></ul></div>
+<a href="#Sample430">Sample 430: Simple Callout Mediator for synchronize web service invocation</a></li></ul></li></ul></li>
+        <li>
+          <a href="#Task">Introduction to Eventing</a>
+          <ul>
+            <li>
+              <a href="#Sample500">Sample 500: Introduction to Eventing</a>
+            </li>
+            <li>
+              <a href="#Sample501">Sample 501: EventSource with static subscriptions</a>
+            </li>
+            <li>
+              <a href="#Sample502">Sample 502: Transform events before publish</a>
+            </li>
+          </ul>
+        </li>
+</ul></div>
 <h1>
 <a name="MediationSamples" id="MediationSamples">Message Mediation Samples</a> </h1>
 <h2>
@@ -3938,4 +3953,180 @@
 <p>Start Synapse with the sample configuration 430 (i.e. synapse -sample 430). </p>
 <p>In this sample, the callout mediator does the direct service invocation to the StockQuoteService using the client request, gets the response and sets it as the first child of the SOAP message body. Then using the send mediator, the message is sent back to the client. </p>
 <p>Invoke the client as follows. </p>
-<pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</pre></div></body></document>
+<pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</pre></div>
+   <h2>
+      <a name="Sample500" id="Sample500">Sample 500: Simple Eventing Sample</a>
+    </h2>
+    <p>
+      &#xa0;
+    </p>
+<pre xml:space="preserve">&lt;!-- Simple Eventing configuration --&gt;
+&lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;
+     &lt;eventSource name=&quot;SampleEventSource&quot;&gt;
+           &lt;subscriptionManager class=&quot;org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager&quot;&gt;
+               &lt;property name=&quot;topicHeaderName&quot; value=&quot;Topic&quot;/&gt;
+               &lt;property name=&quot;topicHeaderNS&quot; value=&quot;http://apache.org/aip&quot;/&gt;
+           &lt;/subscriptionManager&gt;
+     &lt;/eventSource&gt;
+
+    &lt;sequence name=&quot;PublicEventSource&quot; &gt;
+           &lt;log level=&quot;full&quot;/&gt;
+           &lt;eventPublisher eventSourceName=&quot;SampleEventSource&quot;/&gt;
+    &lt;/sequence&gt;
+
+    &lt;proxy name=&quot;EventingProxy&quot;&gt;
+        &lt;target inSequence=&quot;PublicEventSource&quot; /&gt;
+    &lt;/proxy&gt;
+&lt;/definitions&gt;</pre>
+    <div>
+      <p>
+        <strong>Objective:</strong> Demonstrate the use of the Eventing functionality built with synapse
+      </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 500 (i.e. synapse -sample
+        500).
+      </p>
+      <p>
+        In this sample, the event source creted based on the configuration. Event subscriber subscribes for the events, Event sender publish events and the SimpleStockQuoteService act as the Event Sink.
+      </p>
+      <p>
+        Invoke the client (Subscriber) as follows.
+      </p>
+<pre xml:space="preserve">ant eventsubscriber</pre>
+        <p>
+          Invoke the client (Sender) as follows.
+        </p>
+<pre xml:space="preserve">ant eventsender</pre>
+      <p>
+        Invoke the client (Un-Subscribe) as follows.
+      </p>
+<pre xml:space="preserve">ant eventsubscriber -Dmode=unsubscribe -Didentifier=urn:uuid:6DFDF649A67416BFCC1228112473802909001-111373032</pre>
+        <p>
+          Invoke the client (Re-New) as follows.
+        </p>
+<pre xml:space="preserve">ant eventsubscriber -Dmode=renew -Didentifier=urn:uuid:6DFDF649A67416BFCC1228112473802909001-111373032 -Dexpires=2009-12-31T21:07:00.000-08:00</pre>
+      <p>
+        Invoke the client (GetStatus) as follows.
+      </p>
+<pre xml:space="preserve">ant eventsubscriber -Dmode=getstatus -Didentifier=urn:uuid:6DFDF649A67416BFCC1228112473802909001-111373032</pre>
+    </div>
+   <h2>
+      <a name="Sample501" id="Sample501">Sample 501: EventSource with static subscriptions</a>
+    </h2>
+    <p>
+      &#xa0;
+    </p>
+<pre xml:space="preserve">&lt;!-- Eventing configuration with static subscriptions--&gt;
+&lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;
+     &lt;eventSource name=&quot;SampleEventSource&quot;&gt;
+           &lt;subscriptionManager class=&quot;org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager&quot;&gt;
+               &lt;property name=&quot;topicHeaderName&quot; value=&quot;Topic&quot;/&gt;
+               &lt;property name=&quot;topicHeaderNS&quot; value=&quot;http://apache.org/aip&quot;/&gt;
+           &lt;/subscriptionManager&gt;
+           &lt;subscription id=&quot;mysub1&quot;&gt;
+                &lt;filter source =&quot;synapse/event/test&quot; dialect=&quot;http://synapse.apache.org/eventing/dialect/topicFilter&quot;/&gt;
+                &lt;endpoint&gt;&lt;address uri=&quot;http://localhost:9000/services/SimpleStockQuoteService&quot;/&gt;&lt;/endpoint&gt;
+           &lt;/subscription&gt;
+           &lt;subscription id=&quot;mysub2&quot;&gt;
+                &lt;filter source =&quot;synapse/event/test&quot; dialect=&quot;http://synapse.apache.org/eventing/dialect/topicFilter&quot;/&gt;
+                &lt;endpoint&gt;&lt;address uri=&quot;http://localhost:9000/services/SimpleStockQuoteService&quot;/&gt;&lt;/endpoint&gt;
+                &lt;expires&gt;2020-06-27T21:07:00.000-08:00&lt;/expires&gt;
+           &lt;/subscription&gt;
+     &lt;/eventSource&gt;
+
+    &lt;sequence name=&quot;PublicEventSource&quot; &gt;
+           &lt;log level=&quot;full&quot;/&gt;
+           &lt;eventPublisher eventSourceName=&quot;SampleEventSource&quot;/&gt;
+    &lt;/sequence&gt;
+
+    &lt;proxy name=&quot;EventingProxy&quot;&gt;
+        &lt;target inSequence=&quot;PublicEventSource&quot; /&gt;
+    &lt;/proxy&gt;
+&lt;/definitions&gt;</pre>
+    <div>
+      <p>
+        <strong>Objective:</strong> Demonstrate static subscription capability of Synapse
+      </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 501 (i.e. synapse -sample
+        501).
+      </p>
+      <p>
+        In this sample, two static subscriptions created by providing the SimpleStockQuoteService as the event sink.
+      </p>
+        <p>
+          Invoke the client (Sender) as follows.
+        </p>
+<pre xml:space="preserve">ant eventsender</pre>
+      <p>
+        Event sender will send the events to the static subscriptions
+      </p>
+    </div>
+      <h2>
+         <a name="Sample502" id="Sample502">Sample 502: Transform events before publish</a>
+       </h2>
+       <p>
+         &#xa0;
+       </p>
+   <pre xml:space="preserve">&lt;!-- Eventing configuration with transformation before publish--&gt;
+&lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;
+     &lt;eventSource name=&quot;SampleEventSource&quot;&gt;
+           &lt;subscriptionManager class=&quot;org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager&quot;&gt;
+               &lt;property name=&quot;topicHeaderName&quot; value=&quot;Topic&quot;/&gt;
+               &lt;property name=&quot;topicHeaderNS&quot; value=&quot;http://apache.org/aip&quot;/&gt;
+           &lt;/subscriptionManager&gt;
+           &lt;subscription id=&quot;mysub1&quot;&gt;
+                &lt;filter source =&quot;synapse/event/test&quot; dialect=&quot;http://synapse.apache.org/eventing/dialect/topicFilter&quot;/&gt;
+                &lt;endpoint&gt;&lt;address uri=&quot;http://localhost:9000/services/SimpleStockQuoteService&quot;/&gt;&lt;/endpoint&gt;
+           &lt;/subscription&gt;
+     &lt;/eventSource&gt;
+
+
+    &lt;sequence name=&quot;PublicEventSource&quot;&gt;
+           &lt;log level=&quot;full&quot;/&gt;
+           &lt;xslt key=&quot;xslt-key-req&quot;/&gt;
+           &lt;log level=&quot;full&quot;/&gt;
+           &lt;eventPublisher eventSourceName=&quot;SampleEventSource&quot;/&gt;
+    &lt;/sequence&gt;
+
+    &lt;proxy name=&quot;EventingProxy&quot;&gt;
+        &lt;target inSequence=&quot;PublicEventSource&quot; /&gt;
+    &lt;/proxy&gt;
+
+    &lt;localEntry key=&quot;xslt-key-req&quot; src=&quot;file:repository/conf/sample/resources/transform/transform_eventing.xslt&quot;/&gt;
+&lt;/definitions&gt;</pre>
+       <div>
+         <p>
+           <strong>Objective:</strong> Demonstrate the mediation capability of events before publishsing to event sink.
+         </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 502 (i.e. synapse -sample
+           502).
+         </p>
+         <p>
+           In this sample, the event (order request) transform to a new order with different namesapce using XSLT mediator.
+         </p>
+           <p>
+             Invoke the client (Sender) as follows.
+           </p>
+   <pre xml:space="preserve">ant eventsender</pre>
+         <p>
+           Event publish after transformation.
+         </p>
+       </div>
+</body></document>