Sample 11: A Full Registry based Configuration, and Sharing Configuration Between Multiple Instances

<definitions xmlns="http://ws.apache.org/ns/synapse"> <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry"> <parameter name="root">file:./repository/conf/sample/resources/</parameter> <parameter name="cachableDuration">15000</parameter> </registry> </definitions>

Objective

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.

Pre-requisites

  • Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
  • Start Synapse using the configuration numbered 11 (repository/conf/sample/synapse_sample_11.xml)
    Unix/Linux: sh synapse.sh -sample 11
    Windows: synapse.bat -sample 11

Executing the Client

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

(Note: Full registry based configuration is not dynamic atleast for the moment - i.e. it is not reloading itself)

Invoke the client as follows.

ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/

Synapse will generate the following log output.

[HttpServerWorker-1] INFO LogMediator - message = This is a dynamic Synapse configuration

The actual synapse.xml loaded from the registry is:

<!-- a registry based Synapse configuration --> <definitions xmlns="http://synapse.apache.org/ns/2010/04/configuraiton"> <log level="custom"> <property name="message" value="This is a dynamic Synapse configuration $$$"/> </log> <send/> </definitions>

Back to Catalog