事件驱动发布-订阅架构
Architecture
事件驱动发布-订阅架构图,展示 Kafka 或 RabbitMQ 消息代理、事件序列化、主题分区、向多个消费者的扇出交付以及死信队列错误处理。该模板模拟了生产者和消费者通过消息代理完全解耦的基础异步消息传递模式。对于构建松耦合、可扩展的事件驱动系统的架构师至关重要。
Architecture
死信队列架构图,展示重试策略、指数退避、最大重试阈值、失败消息的 DLQ 路由、运维告警和手动重处理工作流。该模板模拟异步消息系统的关键错误处理模式,确保处理失败时不会静默丢失任何消息。对于构建具有适当故障恢复机制的可靠事件驱动系统至关重要。
Producer { # Message Producer
n1: circle label:"Publish Message"
n2: rectangle label:"Serialize Payload"
n3: rectangle label:"Send to Main Queue"
n1.handle(right) -> n2.handle(left)
n2.handle(right) -> n3.handle(left) [label="Enqueue"]
n3.handle(bottom) -> MainQueue.n4.handle(top) [label="Deliver"]
}
MainQueue { # Main Processing Queue
n4: rectangle label:"Receive Message"
n5: rectangle label:"Attempt Processing"
n6: diamond label:"Processing Succeeded?"
n7: rectangle label:"Acknowledge Message"
n8: rectangle label:"Increment Retry Count"
n9: diamond label:"Max Retries Exceeded?"
n4.handle(right) -> n5.handle(left)
n5.handle(right) -> n6.handle(left)
n6.handle(right) -> n7.handle(left) [label="Yes"]
n6.handle(bottom) -> n8.handle(top) [label="No"]
n8.handle(right) -> n9.handle(left)
n9.handle(top) -> n5.handle(bottom) [label="Retry"]
n9.handle(bottom) -> DLQ.n10.handle(top) [label="Exceeded"]
}
DLQ { # Dead Letter Queue
n10: rectangle label:"Route to DLQ"
n11: rectangle label:"Store Failed Message"
n12: rectangle label:"Alert Operations Team"
n13: rectangle label:"Manual Review Dashboard"
n14: diamond label:"Reprocessable?"
n15: rectangle label:"Requeue to Main"
n16: rectangle label:"Archive and Close"
n10.handle(right) -> n11.handle(left) [label="Preserve Context"]
n11.handle(right) -> n12.handle(left) [label="PagerDuty"]
n12.handle(right) -> n13.handle(left)
n13.handle(right) -> n14.handle(left) [label="Investigate"]
n14.handle(right) -> n15.handle(left) [label="Yes"]
n14.handle(bottom) -> n16.handle(top) [label="No"]
n15.handle(top) -> MainQueue.n4.handle(bottom) [label="Replay"]
}
Without proper error handling, failed messages in event-driven systems are silently lost or cause infinite retry loops that waste resources. A dead letter queue captures messages that exceed retry thresholds, preserving them for investigation and manual reprocessing while keeping the main processing pipeline healthy.
Ignoring failed messages leads to data loss. Infinite retries waste resources and mask bugs. Logging failures without a DLQ makes recovery difficult. This template shows the complete failure handling lifecycle.
| Template Name | 事件驱动死信队列架构 |
| Category | Architecture |
| Steps | 6 workflow steps |
| Format | FlowZap Code (.fz file) |
Architecture
事件驱动发布-订阅架构图,展示 Kafka 或 RabbitMQ 消息代理、事件序列化、主题分区、向多个消费者的扇出交付以及死信队列错误处理。该模板模拟了生产者和消费者通过消息代理完全解耦的基础异步消息传递模式。对于构建松耦合、可扩展的事件驱动系统的架构师至关重要。
Architecture
微服务 API 网关架构图,展示请求路由、JWT 身份验证、速率限制、服务发现以及跨分布式后端服务的响应聚合。该模板模拟微服务生态系统中所有客户端流量的入口点,在请求到达内部服务之前执行安全策略。适合设计具有集中式横切关注点的可扩展 API 基础设施的平台工程师。
Architecture
每服务独立数据库架构图,每个微服务拥有其专用数据存储,通过 Kafka 进行事件驱动同步以实现跨服务数据一致性。该模板展示了微服务数据隔离的核心原则,展示 PostgreSQL 和 MongoDB 如何在多语言持久化策略中共存。对于在保持最终一致性的同时强制服务自治的架构师至关重要。
Architecture
按业务能力组织的微服务分解架构图:身份认证、产品目录、定价和订单履行,每个都有独立的数据存储和 API。该模板展示如何将单体应用拆分为与业务领域对齐的服务,使用 Backend-for-Frontend (BFF) 模式进行客户端特定的聚合。适合规划领域驱动微服务边界的架构师。