This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation :

  • <PRODUCT_HOME>/ repository/samples/ directory that includes all Integration profile samples is changed to <EI_HOME>/ samples/service-bus/.
  • <PRODUCT_HOME>/ repository/samples/resources/ directory that includes all artifacts related to the Integration profile samples is changed to <EI_HOME>/ samples/service-bus/resources/.

Introduction

This sample demonstrates the functionality of dynamic endpoints. Here you will store your endpoints in the registry and refer to them.

Prerequisites

For a list of prerequisites, see Prerequisites to Start the ESB Samples.

Building the sample

The XML configuration for this sample is as follows: 

<definitions xmlns="http://ws.apache.org/ns/synapse">
    <registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
        <parameter name="root">file:samples/service-bus/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>

This configuration file  synapse_sample_10.xml is available in the <EI_HOME>/samples/service-bus directory.

To build the sample

  1. Start the ESB Profile with the sample 10 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.

    The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."

  2. Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.

  3. Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.

  4. Run the following command to start a second Axis2 server on HTTP port 9001 and HTTPS port 9003.

    ./axis2server.sh -http 9001 -https 9003
    

Executing the sample

The sample client used here is the Stock Quote Client, which can operate in several modes. For further details on this sample client and its operation modes, see Stock Quote Client.

To execute the sample client

  1. Run the following command from the <EI_HOME>/samples/axis2Client directory.

    ant stockquote -Dtrpurl=http://localhost:8280/
  2. Execute the client immediately again (within 15 seconds of the last execution) using the above command.
  3. Edit the endpoint definition in the <EI_HOME>/samples/service-bus/resources/endpoint/dynamic_endpt_1.xml file by changing the endpoint address to http://localhost:9001/services/SimpleStockQuoteService

Analyzing the output

When you execute the client for the first time, the message is routed to SimpleStockQuoteService on the default Axis2 instance on HTTP port 9000.

When you execute the client immediately again,  you will see that the endpoint is cached and reused by the ESB. A similar scenario is explained in Sample 9: Introduction to Dynamic Sequences with the Registry.

When you edit the endpoint definition and execute the client again, you will see that the registry loads the new definition of the endpoint once the cache expires.

When the registry loads the new definition of the endpoint,  you will see that the messages are routed to the second sample Axis2 server on HTTP port 9001.

  • No labels