nng icon indicating copy to clipboard operation
nng copied to clipboard

Give tutorials on how to implement common ZMQ patterns

Open kawing-chiu opened this issue 6 years ago • 8 comments

I'm a zmq user, currently evaluating nng for a new project. It turned out to be a rather frustrating experience. I spent two hours searching on the web and reading the manuals of nng, still unsure how to implement the common router-dealer load-balancing pattern in nng (simple round-robin distribution in req/rep or push/pull is not enough in many real world cases). Some mailing-list post suggested to use device with rep/req, but the details are vague: For example, where to put the custom load-balancing logic? Does the identity frame (or more generally, the message format) work like in zmq?

So i think it would be great if some tutorials or guides on how to implement the common zmq patterns can be provided. Through this way, the nng-way of doing things can be demonstrated clearly

kawing-chiu avatar Nov 09 '18 14:11 kawing-chiu

I have a similar request or just a question in fact. How would someone implement a 'fan out' socket, that given a queue of messages will distribute them out to each worker in turn? This is the sort of thing I'm think of http://zguide.zeromq.org/page:all#Divide-and-Conquer.

luke-titley-dwarf avatar Nov 30 '18 10:11 luke-titley-dwarf

Ignore this message. I just realised you have an example 'pipeline' in the getting started page.

luke-titley-dwarf avatar Nov 30 '18 12:11 luke-titley-dwarf

I hava the same question,How can I implement the ZMQ'S ROUTER/DEALER with NNG?
use nng_device? There is any sample code or doc? thx!

americaboy avatar Aug 03 '20 10:08 americaboy

If I understand correctly, NNG's REP is analog to ROUTER when in raw mode or using a context object for asynchronous operations. REQ is similarly analog to DEALER when in raw mode or using a context object. So these socket types are unnecessary... I presume that the same reasoning applies to the lack of XPUB/XSUB in NNG.

EvanBalster avatar Dec 13 '20 03:12 EvanBalster

Raw mode is used for forwarding. And it works with all protocols. Including pub / sub.

gdamore avatar Dec 13 '20 06:12 gdamore

See nng_device.

gdamore avatar Dec 13 '20 06:12 gdamore

getting started page

Sorry, where is this "getting started" page? I can't find any mention of it in the README.md, docs/, the official website or via a web search.

detly avatar May 20 '22 11:05 detly