This section explains how the Message Bus EIP can be implemented using WSO2 ESB. The following topics are covered:
Introduction to Message Bus
Message Bus EIP enables separate applications to work together in a decoupled manner such that, applications can be easily added or removed without affecting each other. It makes maintenance and testing smoother since editing or removing an application will not affect the functionality of any other application. For more information, refer to http://www.eaipatterns.com/MessageBus.html.
Figure 1: Message Bus EIP
How WSO2 ESB implements the EIP
The architecture of the WSO2 ESB is discussed in ESB Architecture of the WSO2 ESB documentation. It illustrates how application logic is layered, and how each of the application logic is separated as a mediator where the message processing is done in a decoupled manner. The mediation process is explained in Message Mediation section of the WSO2 ESB documentation.
A sample ESB configuration is illustrated below:
<definitions xmlns="http://ws.apache.org/ns/synapse"> <!-- filtering of messages with XPath and regex matches --> <filter source="get-property('To')" regex=".*/StockQuote.*"> <send> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> </send> <drop/> </filter> <send/> </definitions>
According to the configuration above, the ESB routes an incoming message to a back-end server if the conditions mentioned in the filer section are met. Note how each application's logic is decoupled. It uses one component for filtering, and another to send a message to the endpoint. If a user decides to remove the filtering step, s/he can remove the filter mediator segment from the XML. This will not affect the application's logic on sending the message to the back-end.