Event Driven Architecture

1. Event Driven Architecture basics

1) what is event?

event == a significant and unpredictable change in state

2) In EDA, a notable thing happened inside or outside your business, which disseminates immediately to all interested parties. The interested parties evaluate the event, and optionally take action.

2. 其实event并不是一个新的概念,在软件或者硬件系统级别早就已经对event的概念屡见不鲜了,比如嵌入式系统中的中断。而event-driven Architecture也不是新鲜的理念,那么为什么最近开始受到关注了呢?也许是随着Domain Driven Design的流行吧。

3. Event Driven Architecture所能带来的优点(why introduct Event Driven Architecture)

1)enable business system to become more agile and responsive;

how:the publish/subscribe architecture meet the nature of business

Existing computer system works in this way: 
Most computer systems are built on a command-and-control scheme: one method calls another method and instructs it to perform some action or to retrieve some required information.

Real world business actually works this way:

But often the real world works differently. A company receives a new order; a web server receives a request for a Web page, the right front wheel of my car locks up. In neither case did the system (order processing, web server, anti-lock brake control) schedule or request the action. Instead the event occurred based on external action or activity, caused either by the physical world or another, connected computer system.

There comes the question:

The real world is full of events. The alarm goes off; the phone rings; the “gas low” warning light in the car comes on. Many computer systems, especially embedded systems, are designed to respond to event. As of now, many of the systems that function based on external events live in a rather small universe, most of them even invisible to the user. However, as computer systems become more and more interconnected they start to publish and receive an increasing number of events.

As for these events, we often find ourselves trying to infer the user intent behind these events rather than modelling these events as first class concerns. One method of achieving this outcome is to use an event sourced architecture with application events being mapped to business meaningful events.

Could we change the architecture of our system to relinquish control and instead respond to events as they arrive? What would such a system look like?

An example of how EDA works to smaller the gap:

 

An order management system may receive orders from a Web site or an order entry application and notify other systems of the new order. Systems interested in new orders might be the financial system, which will see whether the order is backed with a credit line or a valid credit card to charge, and the warehouse, which verifies that inventory to fulfill the order is present. Each of these systems might then publish another event to any interested party. The shipping system in turn might wait for both an Inventory Allocated and Payment Processed message and in response prepare the goods for shipment.

This event-based style of interaction is notably different from the traditional command-and-control style that would have the warehouse ask for the inventory status, wait for a answer, and then ask the financial system to process the payment. Next, the order management system would wait for a positive answer and lastly instruct the shipping system to send the goods.

 

2) Event Driven Architecture本身具有的一些优点

broadcast communication;

timeliness: system publish events as they occur instead of storing them locally and waiting for the processing cycle, such as a nightly batch cycle

asynchrony: the publishing system does not wait fro the receiving system to process the event.

 

an aura of simple elegance: because these systems are modelled after real world events the resulting system model is usually very expressive. These desirable benefits have already motivated some to proclaim that EDAs are the next step in the evolution beyond SOA. However, the simple elegance of EDAs may be deceiving. Designing such a system correctly can be more challenging.

extremely loose couple: event emitter不会知道也不关心event publish后会被谁处理,什么时候处理以及如何处理;

 

 

Event Driven Architecture

上一篇:Ftp启动与关闭


下一篇:Creole