Files
nexus/wiki/concepts/Event-Driven-Architecture.md

50 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Event-Driven Architecture"
type: concept
tags:
- EDA
- Architecture
- Cloud
- Microservices
last_updated: 2026-04-14
---
## Aliases
- EDA
- Event Driven Architecture
- 事件驱动架构
## Definition
事件驱动架构EDA是一种软件架构范式通过在松耦合的生产者Producer和消费者Consumer之间传递事件Event来实现系统解耦。事件是状态变化或更新的通知触发异步处理和响应。
## Core Components
- **Event Producer**:事件的产生者,感知状态变化并发布事件
- **Event Consumer**:事件的订阅者和处理者,响应事件执行相应逻辑
- **Event Broker**:事件的中介路由器,负责分发和传递事件
## Event Broker Types
- **Event Router**事件路由器过滤并路由事件到正确的消费者SNS / EventBridge
- **Event Store**事件存储流式存储事件消费者自行过滤所需事件SQS / Kinesis
## Key Design Principles
- **Decoupling**:生产者和消费者完全解耦,独立演进
- **Scalability**:各组件可独立扩展
- **Resilience**:局部故障不影响整体系统
- **Idempotency**:幂等性保证异步重试不产生副作用
## Best Practices
- 稀疏事件sparse events适合频繁变化的数据但消费者可能需要额外查询详情
- 完整状态事件full state包含更多细节但受 EventBridge 负载大小限制
- 事件排序需使用 SQS FIFO 或 Kinesis Data Streams
- EventBridge 最佳实践:每个订阅者使用单一规则、避免为自定义事件使用默认事件总线、使用死信队列处理失败事件
## Related Messaging Patterns
- [[Fan-Out-Pattern]]:扇出模式
- [[Competing-Consumer-Pattern]]:竞争消费者模式
- [[Choreography]]:编舞模式
- [[Orchestration]]:编排模式
## Sources
- [[public-cloud-learning-sessions-opentext-event-driven-architecture-part-1-2024091]]
- [[public-cloud-learning-sessions-opentext-event-driven-architecture-part-2-2024091]]