Event-Driven Microservices Architecture with RabbitMQ / Kafka / Redis
Design decoupled, event-driven microservices architectures featuring publisher/subscriber patterns, idempotency, and saga transactions.
System Directive • Copy and Paste Below
Act as a Chief Systems Architect specializing in event-driven distributed microservices architectures and asynchronous messaging. Design an event-driven architecture for the following business workflow to replace a synchronous, tightly coupled monolith. ### SYSTEM SPECIFICATIONS: - Business Workflow: [WORKFLOW_NAME_E_G_ECOMMERCE_CHECKOUT_USER_ONBOARDING] - Microservices Involved: [LIST_OF_MICROSERVICES] - Message Broker Preference (RabbitMQ, Apache Kafka, AWS SQS/SNS, Redis Streams): [MESSAGE_BROKER] - Eventual Consistency Tolerance & Transaction Guarantees: [CONSISTENCY_REQUIREMENTS] ### ARCHITECTURAL BLUEPRINT: 1. **Event Schema & Contract Definitions (CloudEvents Specification)**: - Structured JSON event payloads for key domain events (e.g. `OrderPlaced`, `PaymentProcessed`, `InventoryReserved`, `NotificationSent`). - Defining: `event_id`, `timestamp`, `aggregate_id`, `version`, and `payload`. 2. **Topic & Exchange Routing Topology**: - Publisher / Subscriber routing rules (Direct, Fanout, or Topic exchanges in RabbitMQ, or Partition keys in Kafka). 3. **Distributed Transaction Management (The Saga Pattern)**: - Choreography vs Orchestration Saga implementation for handling multi-service rollback (e.g. if payment succeeds but inventory reservation fails). 4. **Idempotent Consumer Implementation**: - Code pattern showing how worker services safely process duplicate messages without double-executing side effects. 5. **Dead Letter Queue (DLQ) & Poison Pill Protocol**: - Automated routing of corrupted messages to a DLQ with exponential retry backoff and monitoring alerts.
Customization & Placeholders
Specify your microservices and message broker. The architecture includes Saga rollback patterns to preserve data consistency.
Example Input Values
Workflow: Order Checkout, Services: Order Service, Payment Service, Inventory Service, Email Service, Broker: RabbitMQ.
Expected Output Structure
CloudEvents JSON schemas, RabbitMQ exchange topology, Saga compensation transaction flow, and Python/Node consumer code.
Event-Driven Systems & Microservices
Qubenix decouples complex enterprise architectures into high-throughput, event-driven microservices with zero single points of failure.
More Prompts in Coding & Development
React & TypeScript Clean Component Architecture & State Management
Architect clean, maintainable React 19 / TypeScript components using compound patterns, custom hooks, and zero re-render bloat.
PostgreSQL / MySQL Query Optimization, Indexing & EXPLAIN ANALYZE
Diagnose slow database queries, optimize table schemas, and design composite B-Tree/GIN indexes to drop execution time by 90%+.
Enterprise REST & GraphQL API Schema Designer with OpenAPI Specs
Design clean, pragmatic RESTful endpoints or GraphQL schemas adhering to OpenAPI 3.1 standards, pagination, and status codes.