Publish/Subscribe

In this chapter, we let the broker copy one message to every service that acts on it, so that we can add a service without changing the one that sends the message.

After reading this chapter, you should be able to:

  • Decide whether work between two services should go through a queue
  • Explain why point-to-point messaging makes the sender know every receiver’s queue
  • Explain how a broker copies a message to every queue on a topic’s list
  • Define topic, publisher, subscriber, and publish/subscribe
  • Add a subscriber or a topic without changing the publisher
  • Explain competing consumers, and when every instance of a service needs its own copy
  • Distinguish publish/subscribe from asynchronous processing by three kinds of independence
  • Compare three ways brokers build publish/subscribe
  • Define event stream, stream processing, and batch processing
  • Explain the cost of publish/subscribe, and decide when to use it
  • Recognize publish/subscribe in webhooks and push notifications

Sections

  1. Shipping a Placed Order
  2. One Queue or Three
  3. The Broker Makes the Copies
  4. Publish/Subscribe
  5. Adding a Subscriber
  6. Instances of a Subscriber
  7. Publish/Subscribe and Asynchronous Processing
  8. How Brokers Build Publish/Subscribe
  9. Event Streams
  10. Following an Order Through the System
  11. Webhooks and Push Notifications