Publish-Subscribe Pattern 21 November 2026 | 2 min read Decouple producers and consumers with topics and brokers, delivery guarantees, and when to pick Kafka, Redis, RabbitMQ or SNS.
Decouples producers (publishers) from consumers (subscribers) in messaging systems. Publishers send messages to topics/channels without knowing who receives them. Subscribers express interest in topics and receive relevant messages.
Scalability: Add consumers without changing producers
Flexibility: Consumers can come/go independently
Async Communication: Non-blocking, fire-and-forget
Decoupling: Publishers don’t know subscriber details
Complexity: Message routing, ordering, delivery guarantees
Broker Reliability: Single point of failure (cluster for HA)
Debugging: Harder to trace message flows
Ordering: Not guaranteed across partitions/subscribers
Redis Pub/Sub — Simple, in-memory, no persistence
Redis Streams — Consumer groups, persistence (Kafka-lite)
RabbitMQ — AMQP, flexible routing, multiple protocols
Apache Kafka — High throughput, log retention, replay
AWS SNS/SQS — Managed, serverless, integration with Lambda
Google Pub/Sub — Managed, global, exactly-once option
NATS — Lightweight, fast, JetStream for persistence