Queues vs Streams vs Pub/Sub By David Boyne

Queues vs Streams vs Pub/Sub By David Boyne

Queues vs Streams vs Pub/Sub

When working with event-driven architectures it’s important to know the difference between queues, streams and pub/sub. At a glance they may look similar but they are completely different.

Queues

  • Messages are put onto a queue and consumers consume the message to process them.

  • Messages are acknowledged as they are consumed and deleted after they a processed.

  • Messages can be consumed by many consumers giving you the ability to process messages in parallel also known as Competing Consumers (as seen in the Enterprise Integration Patterns).

  • An real-world example of this would be queuing at the shops. You stand in one big queue (message queue) with one cashier (consumer), that cashier is processing each shopper (message). Shops open up more cashiers (consumers) to help with the customers (messages). Similar thought process with channels, messages and queues.

  • Explore the “Point-to-point messaging” visual to dive into messaging patterns.

Streams

Pub/Sub (Publish/Subscribe)

Extra Resources

Download EDA Visuals

Join over 8,000 others learning EDA and download all the EDA visuals directly to your computer. This document updates everytime a new visual is added so make sure you come back to get the latest.

Download now →
Diagrams and thoughts by @boyney123 to help you learn.