Publish/Subscribe (Pub/Sub) is an asynchronous messaging style used in serverless and microservices architectures. With this model, messages are not sent to a specific subscriber but are instead categorized to be available to all subscribers of the category.
The main characteristic of Pub/Sub APIs is the existence of publishers and subscribers, as the name implies. Publishers categorize messages and those that are subscribed to a specified category receive that message. For example,
Kafka APIs are considered to be a type of Pub/Sub based APIs. Other types of APIs and microservices can also be built around a Pub/Sub system, including REST APIs.
For example, REST APIs use POST and DELETE operations to integrate with Pub/Sub.
Pub/Sub systems have been around since the late 1980s. However, Pub/Sub systems and Pub/Sub-based APIs also have more modern implementations.
One of the most notable is the Cloud Pub/Sub by Google Cloud. Based on this, we believe Pub/Sub-based APIs are here to stay, and these systems may inspire new types of APIs — like Kafka.