Author: asankha
Date: Thu Nov 23 01:06:14 2006
New Revision: 478516

URL: http://svn.apache.org/viewvc?view=rev&rev=478516
Log:
add an example to illustrate support for dynamic sequences in synapse

Added:
    incubator/synapse/trunk/java/repository/conf/sample/resources/sequence/
    
incubator/synapse/trunk/java/repository/conf/sample/resources/sequence/dynamic_seq_1.xml
    incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_9.xml
Modified:
    incubator/synapse/trunk/java/src/site/resources/Synapse_Samples.html

Added: 
incubator/synapse/trunk/java/repository/conf/sample/resources/sequence/dynamic_seq_1.xml
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/resources/sequence/dynamic_seq_1.xml?view=auto&rev=478516
==============================================================================
--- 
incubator/synapse/trunk/java/repository/conf/sample/resources/sequence/dynamic_seq_1.xml
 (added)
+++ 
incubator/synapse/trunk/java/repository/conf/sample/resources/sequence/dynamic_seq_1.xml
 Thu Nov 23 01:06:14 2006
@@ -0,0 +1,8 @@
+<sequence name="dynamic_sequence" xmlns="http://ws.apache.org/ns/synapse";>
+       <in>
+               <log level="custom">
+         <property name="message" value="*** Test Message 1 ***"/>
+               </log>
+       </in>
+       <send/>
+</sequence>
\ No newline at end of file

Added: incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_9.xml
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_9.xml?view=auto&rev=478516
==============================================================================
--- incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_9.xml 
(added)
+++ incubator/synapse/trunk/java/repository/conf/sample/synapse_sample_9.xml 
Thu Nov 23 01:06:14 2006
@@ -0,0 +1,39 @@
+<!--
+  ~  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.
+  -->
+
+<synapse xmlns="http://ws.apache.org/ns/synapse";>
+
+    <!-- introduction dynamic sequences -->
+
+    <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
+        <!-- the root property of the simple URL registry helps resolve a 
resource URL as root + key -->
+        <property name="root" value="file:repository/conf/sample/resources/"/>
+        <!-- all resources loaded from the URL registry would be cached for 
this number of milli seconds -->
+        <property name="cachableDuration" value="15000"/>
+    </registry>
+
+    <definitions>
+        <sequence name="dynamic_sequence" key="sequence/dynamic_seq_1.xml"/>
+    </definitions>
+
+    <rules>
+        <sequence ref="dynamic_sequence"/>
+    </rules>
+
+</synapse> 
\ No newline at end of file

Modified: incubator/synapse/trunk/java/src/site/resources/Synapse_Samples.html
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/src/site/resources/Synapse_Samples.html?view=diff&rev=478516&r1=478515&r2=478516
==============================================================================
--- incubator/synapse/trunk/java/src/site/resources/Synapse_Samples.html 
(original)
+++ incubator/synapse/trunk/java/src/site/resources/Synapse_Samples.html Thu 
Nov 23 01:06:14 2006
@@ -449,6 +449,47 @@
 
 <p></p>
 
+<h2>Sample 9:</h2>
+
+<p><strong>Objective: Introduction to dynamic sequences with a
+Registry</strong></p>
+
+<p><strong>Pre-Requisites:</strong><br>
+Start the Synapse configuration numbered 9: i.e. synapse -sample 9<br>
+Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
+above)</p>
+
+<p>This example introduces the dynamic behaviour of Synapse through the use
+of a Registry. Synapse supports dynamic definitions for sequences, the main
+rules, endpoints and as seen before resources and properties. In this example
+we define a Synapse configuration which references a sequence definition
+specified as a registry key. The registry key resolves to the actual content
+of the sequence which would be loaded dynamically by Synapse at runtime, and
+cached accordingly as per its registry definition. Once the cache expires,
+Synapse would recheck the meta information for the definition and re-load the
+sequence definition if necessary and re-cache it again.</p>
+
+<p>Once Synapse is started, execute the stock quote client as 'ant
+stockquote'. You will notice that that Synapse fetches the definition of the
+sequence from the registry and executes its rules as follows:</p>
+<pre>DEBUG SequenceMediator - Sequence mediator &lt;anonymous&gt; :: 
mediate()<br>INFO SimpleURLRegistry - ==&gt; Repository fetch of resource with 
key : sequence/dynamic_seq_1.xml<br>.....<br>INFO LogMediator - message = *** 
Test Message 1 ***<br>...</pre>
+
+<p>Now if you execute the client immidiately (i.e. within 15 seconds of the
+last execution) you will notice that the sequence was not reloaded. If you
+now edit the repository/conf/sample/resources/sequence/dynamic_seq_1.xml and
+edit the log message to read as "*** Test Message 2 ***" and execute the
+client again, you will notice that the new message is not yet visible (i.e.
+if you execute this within 15 seconds of loading the resource for the first
+time) However, after 15 seconds have elapsed since the original caching of
+the sequence, you will notice that the new sequence is loaded and executed by
+Synapse from the following log messages:</p>
+<pre>DEBUG SequenceMediator - Sequence mediator &lt;anonymous&gt; :: 
mediate()<br>DEBUG AbstractRegistry - Cached object has expired for key : 
sequence/dynamic_seq_1.xml<br>DEBUG SimpleURLRegistry - Perform RegistryEntry 
lookup for key : sequence/dynamic_seq_1.xml<br>INFO SimpleURLRegistry - ==&gt; 
Repository fetch of resource with key : 
sequence/dynamic_seq_1.xml<br>...<br>INFO LogMediator - message = *** Test 
Message 2 ***<br>...</pre>
+
+<p>The cache timeout could be tuned appropriately by configuring the URL
+registry to suite the environment and the needs.</p>
+
+<p></p>
+
 <h2>Sample 50:</h2>
 
 <p><strong>Objective: Connecting to endpoints with WS-Security for outgoing



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to