Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish/Subscribe vs Producer/Consumer?

From messaging point of view with systems like Kafka, RabbitMQ, HornetQ, ActiveMQ, etc. is there a difference between pub/sub and prod/con or are they used interchangeably?

like image 206
user432024 Avatar asked Feb 26 '17 17:02

user432024


People also ask

Is pub-sub same as producer consumer?

Publiser and Subscriber then? Yes, Publisher/Subscriber and Producer/Consumer are used interchangeably but not Pub/Sub and Producer/Consumer. Publisher/Subscriber is specifically used in Pub/Sub messaging pattern and Producer/Consumer in P2P messaging pattern.

When to Use publish subscribe model?

Publish/Subscribe (Pub/Sub) messaging provides instant event notifications for these distributed applications. The Publish Subscribe model allows messages to be broadcast to different parts of a system asynchronously.

What are the differences between publisher subscriber and message queue models?

In a message-queue model, the publisher pushes messages to a queue where each subscriber can listen to a particular queue. In the event-stream model using Pub/Sub, the publisher pushes messages to a topic that multiple subscribers can listen to.

Is pub-sub a message queue?

The Pub Sub queue (or Pub/Sub) is a message pattern of message brokers and it is used to communicate between the various components of microservices. It is used to provide program-to-program and asynchronous communication between the micro-services.


1 Answers

There is a difference between the publish/subscribe and producer/consumer models.

Publish/Subscribe : Subscribers subscribe to the publisher. Each message the Publisher publishes is sent to all the subscribers. That is, all subscribers receive the same message. (Think of a newspaper or magazine subscription. All subscribers receive the same magazine or newspaper)

Producer/Consumer : Each message the producer produces will be consumed by a single consumer. This is a mechanism to distribute the work load to multiple consumers. (Think of the several cash registers at the supermarket. Each customer goes to a single cash register. The customers are like the messages that are produced and the cash registers are the consumers)

like image 52
Can't Tell Avatar answered Sep 30 '22 02:09

Can't Tell