IT lexicon › Programming › Pub-sub (Publish-Subscribe)

Pub-sub (Publish-Subscribe)

Programming På svenska → Updated: 2026-05-23

Messaging pattern where publishers send messages to a "topic" without knowing which subscribers are listening. Loose coupling between components.

Two flavours: topic-based (subscribers list specific topics) and content-based (subscribers filter by message content). Implemented both in-process (event bus, observer pattern) and cross-system (Kafka, NATS, Redis Pub/Sub, GCP Pub/Sub).

Sweet spot: one-to-many broadcasts, decoupled event-driven architecture. Trade-off: harder to reason about the system ("who's listening?"). Competitor: queues (one-to-one, more ordering), direct RPC.

← Back to the lexicon