Skip to content
_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN DE
Let's talk

Redis Pub/Sub

10. 06. 2023 Updated: 27. 03. 2026 1 min read intermediate
This article was published in 2023. Some information may be outdated.

Simple publish-subscribe for notifications.

Basics

PUBLISH notifications '{"user":1,"msg":"New message"}'
SUBSCRIBE notifications
PSUBSCRIBE notifications:*

Limitations

  • Fire-and-forget
  • Offline = lost messages
  • No persistence
  • For reliable → Streams or Kafka

Use cases: - Real-time notifications - Chat - Cache invalidation

Architecture and Limitations

Redis Pub/Sub works on a fire-and-forget principle — messages are delivered only to clients that are currently connected and subscribed to the channel. If a subscriber restarts or loses connection, messages sent in the meantime are lost. There is no backlog or replay mechanism.

Pattern subscribe (PSUBSCRIBE) allows subscribing to multiple channels at once using wildcards. For example, PSUBSCRIBE notifications:* captures messages from notifications:user:1 and notifications:system. For cache invalidation, Pub/Sub is ideal — when data changes, you publish a message and all application instances invalidate their local cache. For reliable message delivery with at-least-once guarantees, use Redis Streams, which offer consumer groups and acknowledgment.

Pub/Sub for Simple Real-time

For reliable messaging use Redis Streams.

redispub/submessaging
Share:

CORE SYSTEMS team

We build core systems and AI agents that keep operations running. 15 years of experience with enterprise IT.