This section explains, through an example scenario, how the Message Dispatcher EIP can be implemented using WSO2 ESB. The following topics are covered:
Table of Contents |
---|
...
Message Dispatcher EIP (Figure 1) | Message Dispatcher Example Scenario (Figure 2) |
---|---|
Sender | Simple Stock Quote Client |
Messages | Simple Stock Quote Requests |
Message Dispatcher | Message Endpoint, Load-Balance Endpoint |
Performers | Simple Stock Quote Server Instances |
...
- Download and install WSO2 ESB from http://wso2.com/products/enterprise-service-bus. For a list of prerequisites and step-by-step installation instructions, refer to Getting Started in the WSO2 ESB documentation.
- Start three sample Axis2 server instances on ports 9000, 9001, and 9002. For instructions, refer to the section Setting Up the ESB Samples Setup - Starting Sample Back-End Servicesthe Axis2 server in the WSO2 ESB documentation.
...
Start the ESB server and log into its management console UI (https:
//localhost:9443/carbon
). In the management console, navigate to the Main Menu, click Service Bus and then Source View menu and click Source View in the Service Bus section. Next, copy and paste the following configuration, which helps you explore the example scenario, to the source view.
Anchor | ||||
---|---|---|---|---|
|
...
Simulating the sample scenario
Repeatedly send several requests to the ESB using the Stock Quote client as follows:
ant stockquote -Dtrpurl=http://localhost:8280/ -Dsymbol=foo
...
Let's investigate the elements of the ESB configuration in detail. The line numbers below refer to the ESB configuration shown above.
- endpoint [line 13 in ESB config] - Defines the endpoint where the request should be sent.
- loadbalance [line 14 in ESB config] - Defines a set of endpoints where incoming requests are distributed using a particular algorithm. In this example, the algorithm distributes messages in a weighted round-robin manner.