Author: asankaa
Date: Fri Dec 19 13:09:07 2008
New Revision: 27440
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=27440

Log:
add new sample to demonstrate mediation capability before event publish


Added:
   
branches/synapse/1.2.wso2v1/repository/conf/sample/resources/transform/transform_eventing.xslt
   branches/synapse/1.2.wso2v1/repository/conf/sample/synapse_sample_502.xml
      - copied, changed from r27438, 
/branches/synapse/1.2.wso2v1/repository/conf/sample/synapse_sample_501.xml
Modified:
   branches/synapse/1.2.wso2v1/src/site/xdoc/Synapse_Samples.xml

Added: 
branches/synapse/1.2.wso2v1/repository/conf/sample/resources/transform/transform_eventing.xslt
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/repository/conf/sample/resources/transform/transform_eventing.xslt?pathrev=27440
==============================================================================
--- (empty file)
+++ 
branches/synapse/1.2.wso2v1/repository/conf/sample/resources/transform/transform_eventing.xslt
      Fri Dec 19 13:09:07 2008
@@ -0,0 +1,34 @@
+<?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.
+  -->
+<xsl:stylesheet version="2.0"
+       xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+       xmlns:fn="http://www.w3.org/2005/02/xpath-functions";>
+       <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" />
+       <xsl:template match="/">
+               <e:placeOrder xmlns:e="http://services.samples/xsd";>
+                       <e:order>
+                               <e:price>100.10</e:price>
+                               <e:quantity>3000</e:quantity>
+                               <e:symbol>SUNW</e:symbol>
+                       </e:order>
+               </e:placeOrder>
+       </xsl:template>
+</xsl:stylesheet>
+

Copied: 
branches/synapse/1.2.wso2v1/repository/conf/sample/synapse_sample_502.xml (from 
r27438, 
/branches/synapse/1.2.wso2v1/repository/conf/sample/synapse_sample_501.xml)
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/repository/conf/sample/synapse_sample_502.xml?rev=27440&r1=27438&r2=27440&view=diff
==============================================================================
--- /branches/synapse/1.2.wso2v1/repository/conf/sample/synapse_sample_501.xml  
(original)
+++ branches/synapse/1.2.wso2v1/repository/conf/sample/synapse_sample_502.xml   
Fri Dec 19 13:09:07 2008
@@ -17,7 +17,7 @@
   ~  under the License.
   -->
 
-<!-- Eventing configuration with static subscriptions-->
+<!-- Eventing configuration with transformation before publish-->
 <definitions xmlns="http://ws.apache.org/ns/synapse";>
      <eventSource name="SampleEventSource">
            <subscriptionManager 
class="org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager">
@@ -31,14 +31,12 @@
                 <filter source ="synapse/event/test" 
dialect="http://synapse.apache.org/eventing/dialect/topicFilter"/>
                 <endpoint><address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/></endpoint>
            </subscription>
-           <subscription id="mysub2">
-                <filter source ="synapse/event/test" 
dialect="http://synapse.apache.org/eventing/dialect/topicFilter"/>
-                <endpoint><address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/></endpoint>
-                <expires>2020-06-27T21:07:00.000-08:00</expires>
-           </subscription>
      </eventSource>
 
-    <sequence name="PublicEventSource" >
+
+    <sequence name="PublicEventSource">
+           <log level="full"/>
+           <xslt key="xslt-key-req"/>
            <log level="full"/>
            <eventPublisher eventSourceName="SampleEventSource"/>
     </sequence>
@@ -46,4 +44,6 @@
     <proxy name="EventingProxy">
         <target inSequence="PublicEventSource" />
     </proxy>
+
+    <localEntry key="xslt-key-req" 
src="file:repository/conf/sample/resources/transform/transform_eventing.xslt"/> 
   
 </definitions>
\ No newline at end of file

Modified: branches/synapse/1.2.wso2v1/src/site/xdoc/Synapse_Samples.xml
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/src/site/xdoc/Synapse_Samples.xml?rev=27440&r1=27439&r2=27440&view=diff
==============================================================================
--- branches/synapse/1.2.wso2v1/src/site/xdoc/Synapse_Samples.xml       
(original)
+++ branches/synapse/1.2.wso2v1/src/site/xdoc/Synapse_Samples.xml       Fri Dec 
19 13:09:07 2008
@@ -451,6 +451,9 @@
             <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>
@@ -5510,5 +5513,62 @@
         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>

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to