其他分享
首页 > 其他分享> > 事件驱动 —— Event-driven architecture style

事件驱动 —— Event-driven architecture style

作者:互联网

原文:https://docs.microsoft.com/en-us/azure/architecture/guide/architecture-styles/event-driven

 

An event-driven architecture consists of event producers that generate a stream of events, and event consumers that listen for the events.

 

 Events are delivered in near real time, so consumers can respond immediately to events as they occur. Producers are decoupled from consumers — a producer doesn't know which consumers are listening. Consumers are also decoupled from each other, and every consumer sees all of the events. This differs from a Competing Consumers pattern, where consumers pull messages from a queue and a message is processed just once (assuming no errors). In some systems, such as IoT, events must be ingested at very high volumes.

 

An event driven architecture can use a pub/sub model or an event stream model.

On the consumer side, there are some common variations:

 

 

The source of the events may be external to the system, such as physical devices in an IoT solution. In that case, the system must be able to ingest the data at the volume and throughput that is required by the data source.

In the logical diagram above, each type of consumer is shown as a single box. In practice, it's common to have multiple instances of a consumer, to avoid having the consumer become a single point of failure in system. Multiple instances might also be necessary to handle the volume and frequency of events. Also, a single consumer might process events on multiple threads. This can create challenges if events must be processed in order or require exactly-once semantics. See Minimize Coordination.

 

When to use this architecture

 

 

Benefits

 

Challenges

 

zookeeper锁:确保所有event 仅仅执行一次

 

 

Additional considerations

 

标签:event,style,consumers,stream,processing,Event,driven,consumer,events
来源: https://www.cnblogs.com/panpanwelcome/p/14489872.html