Apache Synapse

##### Main Menu

- Home
- Download
- History
- License
- Thanks
- Sponsorship
- Security

##### Documentation

- Installation Guide
- Quick Start Guide
- Samples Setup Guide
- Samples Catalog
- Configuration Language
- Mediators Catalog
- Transports Catalog
- Extending Synapse
- Upgrading
- Deployment
- Javadocs
- FAQ

##### Developer Resources

- Developer Guide
- Development Best Practices
- Release Process

##### Project Details

- Overview
- Mailing Lists
- Source Repository
- Issue Tracking
- Dependencies
- Project Team
- Project Summary

##### Previous Releases

- Version 1.2
- Version 1.1.1
- Version 1.1
- Version 1.0

## Sample 10: Introduction to Dynamic Endpoints with Registry

<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> <sequence name="main"> <in> <send> <endpoint key="endpoint/dynamic_endpt_1.xml"/> </send> </in> <out> <send/> </out> </sequence> </definitions>

### Objective

Demonstrating the ability to load endpoint definitions dynamically from the remote registry.

### Pre-requisites

- Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
- Start another Axis2 server instance on different ports (use the following command)
  Unix/Linux: sh axis2server.sh -http 9001 -https 9003
  Windows: axis2server.bat -http 9001 -https 9003
- Start Synapse using the configuration numbered 10 (repository/conf/sample/synapse_sample_10.xml)
  Unix/Linux: sh synapse.sh -sample 10
  Windows: synapse.bat -sample 10

### Executing the Client

This example introduces dynamic endpoints, where the definition of the endpoint is stored in the registry. To follow this example execute the stock quote client as 'ant stockquote..' and see that the message is routed to the SimpleStockQuoteService on the default Axis2 instance on HTTP port 9000.

ant stockquote -Dtrpurl=http://localhost:8280/

Repeat the above command immediately again, and notice that the endpoint is cached and reused by Synapse - similarly to sample 8.

Now edit the repository/conf/sample/resources/endpoint/dynamic_endpt_1.xml file and update the address to 'http://localhost:9001/services/SimpleStockQuoteService'. After the cached value expires, the Registry loads the new definition of the endpoint, and then the messages are routed to the second sample Axis2 server on HTTP port 9001.

Back to Catalog