Let's consider a webshop, where the user orders goods using the web-interface (and the application server). In a "conventional" architecture, even a SOA a controler component (probably in the appserver) might "orchestrate" the order process by calling several services like the credit check, the customer check, the stock-keeping application, eventually initiating the shipping and following up the payment procedure. When implemented in a SOA way the components are de-coupled at least to a certain degree. Still, the whole system is kept together by the controler compoent. Now, how could we model this "EDA-like":
- First we should use a message oriented middleware (MOM), that supports the publish/subscribe paradigm (e.g., ActiveMQ, Tibco and the like)
- The next important concept is to omit the controler component by inverting responsibilities, meaning: not the controler decides what service should be invoked, but the components themselves decide what they are interested in (which requires a clear strategy of defining message types)
- If the customer orders goods, the web-application server sends a "order" message to the MOM. It does not "address" specific other components, just announces that a new order has arrived
- Now arbitrary components can register for new incoming orders as they need that data to do their job like the credit check component and the stock-keeping component. Both might do their checks and then send new messages into the system like "credit checked" or "stock checked" including a reference to the order message like the order-id
- Eventually the order processing component might wait for all messages that are required for the next step like order, credit-check and stock-check, then initiate the shipping and send the next message that shipping has been done and so on.
Additionally this style of architecture allows a significant level of agility (to come back to the inital scope of the posting) as new components can be easily introduced into the system (e.g., reporting, statistical analysis, components to connect to contractors to initiate reorders and the like) without the need to continuously rewrite the controler component that then gets more and more complex and intransparent.