<?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.
  -->

<document>
    <properties>
        <title>Apache Synapse - Sample 11</title>
    </properties>
    <body>
        <section name="Sample 11: A Full Registry based Configuration, and Sharing Configuration Between Multiple Instances">
            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;

    &lt;registry provider="org.apache.synapse.registry.url.SimpleURLRegistry"&gt;
        &lt;parameter name="root"&gt;file:./repository/conf/sample/resources/&lt;/parameter&gt;
        &lt;parameter name="cachableDuration"&gt;15000&lt;/parameter&gt;
    &lt;/registry&gt;

&lt;/definitions&gt;</div>
            <subsection name="Objective">
                <p>
                    Demonstrating the ability of Synapse to load the entire configuration from
                    a remote registry. This approach can also be used to share a single configuration
                    between multiple Synapse instances by pointing all the Synapse instances to the
                    same URL registry.
                </p>
            </subsection>
            <subsection name="Pre-requisites">
                <p>
                    <ul>
                        <li>
                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
                        </li>
                        <li>
                            Start Synapse using the configuration numbered 11 (repository/conf/sample/synapse_sample_11.xml)
                            <div class="command">
                                Unix/Linux: sh synapse.sh -sample 11<br/>
                                Windows: synapse.bat -sample 11
                            </div>
                        </li>
                    </ul>
                </p>
            </subsection>
            <subsection name="Executing the Client">
                <p>
                    This example shows a full registry based Synapse configuration. This makes it
                    possible to easily start multiple instances of Synapse sharing a single configuration
                    in a clustered environment. The Synapse configuration of a given node hosting
                    Synapse simply points to the registry and looks up the actual configuration by
                    requesting the key 'synapse.xml'. 
                </p>
                <p>(Note: Full registry based configuration is not dynamic atleast for the moment -
                    i.e. it is not reloading itself)</p>
                <p>
                    Invoke the client as follows.
                </p>
                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
                <p>
                    Synapse will generate the following log output.
                </p>
                <div class="consoleOutput">[HttpServerWorker-1] INFO LogMediator - message = This is a dynamic Synapse configuration</div>
                <p>The actual synapse.xml loaded from the registry is: </p>
                <div class="xmlConf">&lt;!-- a registry based Synapse configuration --&gt;
&lt;definitions xmlns=&quot;http://synapse.apache.org/ns/2010/04/configuraiton&quot;&gt;
    &lt;log level=&quot;custom&quot;&gt;
        &lt;property name=&quot;message&quot; value=&quot;This is a dynamic Synapse configuration $$$&quot;/&gt;
    &lt;/log&gt;
    &lt;send/&gt;
&lt;/definitions&gt;</div>

            </subsection>
        </section>
        <p><a href="../samples.html">Back to Catalog</a></p>        
    </body>
</document>