O'Reilly logo

Node.js the Right Way by Jim R. Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required