Pushing and Pulling Messages
So far we’ve worked with two major message-passing patterns; first we looked at publish/subscribe, then request/reply. There’s one more pattern offered by ØMQ that’s sometimes good to use with Node.js—PUSH/PULL.
Pushing Jobs to Workers
The PUSH and PULL socket types are useful when you have a queue of jobs that you want to fairly assign among a pool of available workers.
Recall that with a PUB/SUB pair, each subscriber will receive all messages sent by the publisher. In a PUSH/PULL setup, only one puller will receive each message sent by the pusher.
So PUSH will round-robin-distribute messages to connected sockets, just like the DEALER. But unlike the DEALER/ROUTER flow, there is no backchannel. A message traveling ...
Get Node.js the Right Way now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.