Tutorials System Design Mastery

Pub/Sub vs Point-to-Point communication

On this page

Messaging Patterns

Should one message go to one person, or to everyone? Choosing the right messaging pattern determines how easily you can add new features in the future.

1. Point-to-Point (Queue)

One producer sends a message to exactly one consumer. If multiple consumers exist, they "Competing Consumer" pattern is used—only one gets each message. Best for: Processing payments or sending a single email.

2. Publish/Subscribe (Topic)

The producer publishes to a "Topic." Multiple "Subscribers" can listen to that topic. Every subscriber gets a copy of the message. Best for: Notification systems, Updating multiple caches, or logging.

4. Interview Mastery

Q: "How does Pub/Sub enable 'Plug-and-Play' microservices?"

Architect Answer: "Because the Producer doesn't know who is listening. If you have an 'OrderPlaced' event, today only the 'Shipping' service listens. Tomorrow, if you want to add a 'Marketing' service that sends a coupon, you just point it to the topic. You don't have to change a single line of code in the 'Order' service. This is the ultimate in architectural decoupling."

Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

System Design Mastery
Course syllabus
1. Distributed Systems Fundamentals
2. Database Scalability
3. Caching & CDN Strategies
4. Event-Driven Architecture
5. High Availability & Load Balancing
6. Microservices & API Gateway
7. Monitoring & Disaster Recovery
8. FAANG System Design Interview
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details