O'Reilly logo

ZeroMQ by Pieter Hintjens

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

Chapter 2. Sockets and Patterns

In Chapter 1 we took ØMQ for a drive, with some basic examples of the main ØMQ patterns: request-reply, publish-subscribe, and pipeline. In this chapter, we’re going to get our hands dirty and start to learn how to use these tools in real programs.

We’ll cover:

  • How to create and work with ØMQ sockets

  • How to send and receive messages on sockets

  • How to build your apps around ØMQ’s asynchronous I/O model

  • How to handle multiple sockets in one thread

  • How to handle fatal and nonfatal errors properly

  • How to handle interrupt signals like Ctrl-C

  • How to shut down a ØMQ application cleanly

  • How to check a ØMQ application for memory leaks

  • How to send and receive multipart messages

  • How to forward messages across networks

  • How to build a simple message queuing broker

  • How to write multithreaded applications with ØMQ

  • How to use ØMQ to signal between threads

  • How to use ØMQ to coordinate a network of nodes

  • How to create and use message envelopes for publish-subscribe

  • How to use the high-water mark (HWM) to protect against memory overflows

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