Nov 10, 2018

Common scenarios of Publish/Subscribe pattern

  • Distributing event notifications. For example, a service that accepts user signups can send notifications whenever a new user registers, and downstream services can subscribe to receive notifications of the event.
  • Balancing workloads in network clusters. For example, a large queue of tasks can be efficiently distributed among multiple workers, such as virtual machine instances.
  • Implementing asynchronous workflows. For example, an order processing application can place an order on a topic, from which it can be processed by one or more workers.
  • Data streaming from various processes or devices. For example, a residential sensor can stream data to backend servers hosted in the cloud.
  • Refreshing distributed caches. For example, an application can publish invalidation events to update the IDs of objects that have changed.
  • Reliability improvement. For example, a single-zone cloud instance service can operate in additional zones by subscribing to a common topic, to recover from failures in a zone or region.
  • Logging to multiple systems. For example, a virtual machine instance can write logs to the monitoring system, to a database for later querying, and so on.