Skip to main content

PubSub

PubSub (short for Publish/Subscribe) is an abstraction for a messaging system where senders don't send the message directly to a specific receiver. Instead, messages are grouped into channels that interested receivers (also called subscribers) can subscribe to. Senders (also called publishers) publish messages to there channels which are then independently transmitted to the receivers.

Widely used examples of PubSub systems include WebSub, Kafka and IGMP.

Advantages

Modular

The sender and receiver of messages are decoupled - the publisher doesn't know nor care about which subscribers receive his message and the subscriber doesn't know nor care about which publisher sent the message that he just received. They simply care about channels and are ignorant about the underlying mechanisms for message delivery.

Dynamic

Publishers and subscribers can come and go without affecting the system since they run independently. The messaging system can adapt to changes and keep things running smoothly without interruptions in service.

Scalable

The system has the potential to scale much bigger than traditional client-server messaging systems by taking advantage of better network topology, better routing and message caching among other things.