difference between pub-sub and push-pull pattern in zeroMq

Message QueueZeromqMessaging

Message Queue Problem Overview


This two images are from http://zguide.zeromq.org/page:all.

What is the difference between this two pattern if we ignore sink in push-pull pattern ? Is there a difference in how a message gets transfer, if yes what is the difference ?

Message Queue Solutions


Solution 1 - Message Queue

The difference is that a PUB socket sends the same message to all subscribers, whereas PUSH does a round-robin amongst all its connected PULL sockets.

In your example, if you send just a single message from the root, then all the subscribers will receive it (barring slow subscribers, etc.) but only 1 worker.

The pub/sub pattern is used for wide message distribution according to topics. The push/pull pattern is really a pipelining mechanism. Your push/pull example seems to be attempting to do load-balancing, which is fine, but req/rep might be better suited to that due to other issues.

It looks like the "issues" here are described in the same part of the 0MQ guide you got the image from : push/pull ventilator example

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBhuvanView Question on Stackoverflow
Solution 1 - Message QueueSteveLoveView Answer on Stackoverflow