Responding to Requests
The REQ/REP pattern is quite common in networked programming, particularly in Node. Weâll use this pattern often in the next couple of chapters, and ÃMQ has great support for it. As youâll see in a minute, this is where the âQâ of ÃMQ becomes apparent.
In ÃMQ, a REQ/REP pair communicates in lockstep. A request comes in, then a reply goes out. Additional incoming requests are queued and later dispatched by ÃMQ. Your application, however, is aware of only one request at a time.
Letâs see how this works, again using the filesystem as a source of information for building a microservice. In this scenario, a responder waits for a request for file data, then serves up the content when asked. Weâll start with the ...
Get Node.js 8 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.