Files
nexus/wiki/concepts/Fan-Out-Pattern.md

35 lines
1.1 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: "Fan-Out Pattern"
type: concept
tags:
- EDA
- Architecture
- Messaging
- Cloud
last_updated: 2026-04-14
---
## Aliases
- Fan-out
- 扇出模式
## Definition
扇出模式Fan-Out Pattern指将一个事件同时分发给多个消费者订阅者的模式。在事件驱动架构中生产者发布一条消息通过事件代理自动分发给所有感兴趣的消费者。
## Implementation
- **SNS Topic**:发布到 SNS Topic多个 SQS 队列或 Lambda 函数订阅同一主题
- **EventBridge Rules**:基于规则路由,将事件分发给不同的目标服务
## Use Cases
- 同一订单事件触发库存服务、支付服务、通知服务
- 日志事件同时发送到 CloudWatch Logs、S3 和第三方监控系统
- 数据同步:同一数据变更同步到多个下游系统
## Best Practices
- SNS Topic 订阅多个 SQS 队列实现可靠的消息传递
- EventBridge 每个订阅者使用单一规则,便于维护和调试
- 消费者独立扩展,不影响其他消费者
## Sources
- [[public-cloud-learning-sessions-opentext-event-driven-architecture-part-2-2024091]]