Event-Driven Architecture & Message Ordering Review
Review Kafka, RabbitMQ, or SQS/SNS event architectures for exactly-once semantics, out-of-order delivery, and DLQs.
Interactive Prompt Playground
{{EVENT_PAYLOAD}}{{CONSUMER_CODE}}{{BROKER}}{{SCALE}}You are an Event-Driven Distributed Systems Architect specializing in Apache Kafka, AWS SQS/SNS, and RabbitMQ.
Review the following asynchronous event pipeline and consumer logic:
Event Schema & Publishing Logic:
```json
{
"eventId": "evt_98765",
"eventType": "order.payment_completed",
"aggregateId": "ord_101",
"timestamp": 1718000000,
"data": {
"amount": 99.00,
"currency": "USD",
"customerId": "cust_456"
}
}
```
Consumer Architecture & Processing:
```
async function onMessage(msg) {
const event = JSON.parse(msg.value);
await db.orders.update({ id: event.aggregateId }, { status: 'PAID' });
await emailService.sendReceipt(event.data.customerId, event.data.amount);
}
```
Message Broker: Apache Kafka (Confluent Cloud)
Throughput / Scale: 5,000 events/sec with strict in-order processing per order
Inspect and harden this event architecture:
1. **Ordering Guarantees & Partition Keying**:
- Are messages partitioned by a consistent entity key (e.g. `tenant_id` or `user_id`) to guarantee FIFO ordering?
- What happens when a partition rebalances?
2. **Idempotency & Deduplication**:
- How does the consumer prevent duplicate processing when the broker delivers messages at-least-once?
- Is there a unique event ID or version constraint stored in the database?
3. **Dead-Letter Queues (DLQ) & Poison Pills**:
- Are transient network errors retried with exponential backoff while non-retryable serialization bugs are sent to a DLQ?
4. **Schema Evolution**:
- Is the payload backward and forward compatible (Avro, Protobuf, or JSON Schema)?
Output a comprehensive design evaluation and robust consumer implementation.How to Use This Prompt
- Paste your event payload and consumer processing logic.
- Specify your message broker (Kafka, SQS, RabbitMQ).
- Get hardened idempotency patterns, DLQ retry loops, and partition key advice.
Engineering Tips & Best Practices
- Always include event version and idempotency keys in message headers or envelope schemas.
What This Prompt Inspects
Key failure modes, design principles, and quality standards evaluated during execution.
Idempotent Consumers
Verifies consumer checks processed_events table inside a transaction before side-effects.
Partition Key Uniformity
Ensures high-cardinality partition keys prevent consumer lag and hot partitions.
Poison Pill Isolation
Routes malformed payloads to DLQ without stalling the entire topic partition.
SprintKit Workflow Integrations
Complementary interactive tools and workflows across SprintKit to accelerate your engineering process.
Related Prompts
Explore related developer prompts in this workflow domain.
Microservices Boundary & Domain-Driven Design Decomposition
Deconstruct monoliths or complex systems into bounded contexts with clear domain events and data ownership.
RESTful API Design & Backward Compatibility Review
Design or review RESTful API contracts for idempotency, pagination, error models, and non-breaking versioning.
Technical Design Document (RFC) Generator
Generate thorough, engineering-ready Request for Comments (RFC) and Architecture Decision Records (ADRs).