Skip to content
StackPractices

messaging

Practical resources about messaging for software engineers.

39 results

Connecting Systems with Messages and Events

When direct API calls become bottlenecks, messaging patterns provide the decoupling and resilience needed for distributed systems. Message queues, event buses, and stream processors handle backpressure, retries, and eventual consistency.

This collection covers recipes for implementing pub/sub patterns, using message brokers like RabbitMQ and Kafka, designing event-driven architectures, and handling dead letter queues. Each pattern includes failure scenarios and recovery strategies.

intermediate

Redis Pub/Sub for Cross-Process Messaging

Use Redis pub/sub channels to broadcast events between processes, handle subscriptions, and implement real-time notifications

intermediate

Dead Letter Queues

Handle failed messages gracefully with dead letter queues, retry policies, and poison pill detection in message-driven architectures.

advanced

Event-Driven Microservices

Design event-driven microservices with message brokers, event sourcing, CQRS, and eventual consistency patterns.

advanced

Implement Event Sourcing with CQRS in Python

Build an event-sourced system with CQRS separation using Python, event store persistence, projection rebuilds, snapshots, and idempotent event handlers for audit-ready architectures.

intermediate

Event Streaming with Apache Kafka and Node.js

Build growth-ready event-driven systems using Apache Kafka with producers, consumers, consumer groups, and exactly-once semantics for reliable asynchronous messaging

advanced

Kafka Consumer Groups with Python for Scalable Streaming

Create Kafka consumer groups in Python with partition assignment, offset management, commit strategies, rebalance handling, and exactly-once semantics for scalable stream processing.

intermediate

Consume Kafka Topics with Spring Boot Stream Listeners

Build Kafka consumers in Spring Boot using @KafkaListener annotations, concurrent consumers, error handlers, DLQ patterns, and batch listeners with manual acknowledgment.

advanced

Message Processing Idempotency

Design idempotent message processors that safely handle duplicate deliveries without side effects in async and event-driven systems.

advanced

Implement the Transactional Outbox Pattern for Reliable

Use the transactional outbox pattern to reliably publish domain events alongside database changes, with a relay processor, polling strategies, and exactly-once delivery guarantees.

intermediate

Distribute Background Tasks with Python Celery and Redis

Set up Celery with Redis broker for distributed task processing including task chaining, groups, chords, retry strategies, scheduled tasks with Celery Beat, and result backends.

intermediate

Configure Dead-Letter Queues in RabbitMQ for Failed Messages

Set up dead-letter queues and exchanges in RabbitMQ with TTL expiry, max length limits, rejection-based routing, and retry patterns for resilient messaging.

intermediate

Build a RabbitMQ Consumer with Python and Pika

Create a RabbitMQ consumer and producer in Python using pika with durable queues, work dispatching, acknowledgments, dead-letter exchanges, and prefetch tuning.

intermediate

Task Queues and RPC with RabbitMQ and AMQP

Implement reliable task distribution and request-reply patterns using RabbitMQ with durable queues, dead-letter exchanges, and prefetch for controlled concurrency

intermediate

Implement Redis Pub/Sub Messaging in Python

Build real-time pub/sub messaging with Redis and Python including pattern subscriptions, message serialization, connection pooling, and broadcast patterns for microservices.

intermediate

Event-Driven Lambda with SQS Triggers and Batch Processing

Process SQS messages with Lambda using batch windows, partial batch responses, error handling, and dead-letter queues for resilient event-driven pipelines.

intermediate

Claim Check Pattern

Store large payloads in external storage and pass only a lightweight reference token through the message bus, reducing broker load and preventing message size limits from being exceeded.

advanced

Compensating Transaction Pattern

Undo the effects of a completed transaction by executing a counter-operation, enabling eventual consistency in long-running business processes across distributed services.

intermediate

Dead Letter Channel Pattern

Route unprocessable messages to a separate dead letter queue for inspection and replay. Prevent poison messages from blocking the main queue indefinitely.

intermediate

Event-Carried State Transfer Pattern

Replicate state changes across services by publishing events that carry the full updated entity state, enabling consumers to maintain their own local copies without querying the source.

intermediate

Idempotent Consumer Pattern

Process messages from a queue exactly once regardless of duplicates by using idempotent operations, unique identifiers, and deduplication strategies at the consumer level.

intermediate

Inbox Pattern

Use a dedicated inbox table or queue to record incoming events or requests, ensuring reliable delivery, deduplication, and idempotent processing even when downstream systems fail.

intermediate

Message Deduplication Pattern

Prevent duplicate processing by tracking message IDs with idempotency keys. Consumers check a store before processing to skip messages already handled.

intermediate

Message Deferral Pattern

Delay message processing to a scheduled time. Move messages that cannot be processed now to a deferred queue or schedule them for later delivery.

intermediate

Message Queue Load Leveling Pattern

Smooth traffic spikes by placing a queue between a producer and a consumer. The producer writes messages at any rate; the consumer processes them at a steady pace.

intermediate

Publish-Subscribe Pattern

Broadcast events to multiple independent subscribers. Publishers send messages to a topic without knowing which subscribers exist, enabling loose coupling between producers and consumers.

intermediate

Queue-Based Load Leveling Pattern

Introduce a queue between task producers and consumers to smooth out traffic spikes, decouple components, and prevent downstream services from being overwhelmed by burst workloads.

intermediate

Sequential Convoy Pattern

Preserve message ordering for related messages in a distributed system by grouping them into ordered sequences and processing them one at a time through a single consumer.

intermediate

Dead Letter Queue Runbook

Runbook for handling and replaying dead letter queue messages in Kafka and RabbitMQ: DLQ setup, inspection procedures, root cause analysis, replay strategies, monitoring alerts, and automation scripts for failed message recovery.

intermediate

Kafka Topic Naming Convention Template

Template for standardizing Kafka topic names across teams: naming patterns, environment prefixes, domain segmentation, event type suffixes, partition count rules, and retention policies with examples.

advanced

Message Schema Evolution Policy

Policy for evolving message schemas safely in event-driven systems: backward and forward compatibility rules, schema registry usage, versioning strategies, migration procedures, and breaking change handling with Avro, Protobuf, and JSON examples.

intermediate

RabbitMQ Queue Design Template

Template for documenting RabbitMQ queue, exchange, and binding design: exchange types, queue properties, binding rules, dead letter handling, TTL policies, and capacity planning with code examples.

advanced

Complete Guide to Kafka Stream Processing

Build real-time event streaming pipelines with Kafka. Covers producers, consumers, Kafka Streams, Kafka Connect, schema registry, and stream processing patterns.

intermediate

Complete Guide to Microservices Communication

Compare sync vs async communication patterns for microservices. Covers REST, gRPC, message queues, event-driven, service mesh, and when to use each.

advanced

CQRS + Event Sourcing — Combined Guide

A practical guide to combining CQRS and Event Sourcing: separating read and write models, rebuilding state from events, and handling eventual consistency.

advanced

Stream Processing: Event-Driven Data Pipelines with

A practical guide to stream processing: choosing between Kafka Streams, Flink, and Spark Streaming, designing event schemas, handling stateful operations, and building exactly-once processing pipelines for real-time data.

advanced

Complete Guide to Event-Driven Systems

Design and operate event-driven backends. Covers event sourcing, CQRS, sagas, outbox pattern, idempotency, eventual consistency, and production patterns for reliable event-driven architectures.

advanced

Complete Guide to Apache Kafka in Production

Run Apache Kafka in production with confidence. Covers partitions, replication, consumer groups, monitoring, performance tuning, and operational best practices for high-throughput streaming pipelines.

advanced

Complete Guide to RabbitMQ Architecture

Design and operate RabbitMQ for reliable messaging. Covers exchanges, queues, bindings, routing patterns, dead letter queues, clustering, and production best practices for high-throughput workloads.

intermediate

Message Queues — RabbitMQ, Kafka, and SQS detailed analysis

A thorough guide to message queues: when to use RabbitMQ, Kafka, or SQS. Covers patterns, throughput, ordering, and operational considerations.