Demonstrating the ability to load sequence definitions dynamically from the remote registry.
This example demonstrates the dynamic behaviour of Synapse through the use of a registry. Synapse supports dynamic definitions for sequences and endpoints, and as seen before, for configuration resources (eg: schema files, XSLT files etc). 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 appropriately as per its definition in the registry. Once the cache expires, Synapse would re-check the meta information for the definition and re-load the sequence definition if necessary and re-cache it again.
Execute the client as follows.
Go through the mediation debug logs to see how Synapse has dynamically loaded the sequence configurations from the registry.
Now if you execute the client immediately (i.e. within 15 seconds of the last execution) you will notice that the sequence is not reloaded. If you edit the sequence definition in repository/conf/sample/resources/sequence/dynamic_seq_1.xml (i.e. 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 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.
The cache timeout could be tuned appropriately by configuring the URL registry to suit the environment and the needs.