...
Event-Driven Consumer EIP (Figure 1) | Event-Driven Consumer Example Scenario (Figure 2) |
---|---|
Sender | Simple Stock Quote Client |
Message | Simple Stock Quote Request |
Event Driven Consumer | Event Mediator |
Receiver | Topic Subscriber, Simple Stock Quote Service |
...
- Download and install WSO2 ESB from http://wso2.com/products/enterprise-service-bus. For a list of prerequisites and step-by-step installation instructions, see the Installation Guide in the WSO2 ESB documentation.
- Start two sample Axis2 server. For instructions, see Setting Up the ESB Samples - Starting the Axis2 server in the WSO2 ESB documentation.
- Follow the steps below to create an event.
- Start the ESB server and log into its management console UI (
https:
//localhost:9443/carbon
). - Select the Topics menu from the Main menu and then select the Add sub menu.
- Enter
EventConsumerTopic
as the name for the topic, and then click Add Topic. - Click the newly created topic EventConsumerTopic in the topic browser tree and click Subscribe to create a static subscription.
- Enter the value
http://localhost:9000/services/SimpleStockQuoteService
in the Event Sink URL field and click Subscribe.
- Start the ESB server and log into its management console UI (
ESB configuration
In On the ESB's Management Console, navigate to the Main 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
Send a request using the Stock Quote client to the ESB as follows. For information about the Stock Quote client, see the Sample Clients section in the WSO2 ESB documentation.
Code Block ant stockquote -Dtrpurl=http://localhost:8280 -Dsymbol=foo
After sending the request, note that a message accepting the request
...
is displayed on the Stock Quote service's console. This is triggered as an event when the message is published into the topic
EventConsumerTopic
that you created earlier. All subscribers will receive the topic.
How the implementation works
...
- event [line 13 in ESB config] - Allows you to define a set of subscribers that will to receive messages when the topic subscribed subscribes to receives a message. Also, see Eventing.