You are previewing ZeroMQ.
O'Reilly logo
ZeroMQ

Book Description

For C developers who want a comprehensive introduction to ZeroMQ, this is the perfect tutorial. With a user-friendly approach and practical examples, it covers everything from fundamental message patterns to working with multiple sockets.

  • Learn fundamental message/queue design patterns

  • Work with multi-threaded programs

  • Work with multiple sockets

  • In Detail

    ØMQ (also spelled ZeroMQ, 0MQ, or ZMQ) is a high-performance asynchronous messaging library aimed at use in scalable distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a ØMQ system can run without a dedicated message broker. The library is designed to have a familiar socket-style API.

    "ZeroMQ" teaches you to use ZeroMQ through examples in C programming language. You will learn how to use fundamental patterns of message/queuing with a step-by-step tutorial approach and how to apply them. Then, you’ll learn how to use high level APIs and to work with multiple sockets and multithreaded programs through many examples.

    This book looks at how message/queue works in general and what kinds of problems it solves. Then, it explains how ZeroMQ works and how it differs from other message/queue libraries and how it can be used in different scenarios.

    You will also learn how to apply essential message/queue design patterns in different scenarios, and how they differ from each other. It shows you practical examples you can apply. You will also learn how to work with multiple sockets.

    You will learn the basics of ZeroMQ as well as how to use different patterns.

    Table of Contents

    1. ZeroMQ
      1. Table of Contents
      2. ZeroMQ
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started
        1. The beginning
        2. The message queue
        3. Introduction to ZeroMQ
          1. Simplicity
          2. Performance
          3. The brokerless design
        4. Hello world
          1. The request-reply pattern
            1. Reply
              1. The fair-queue strategy
            2. Request
            3. Sending the message
        5. Handling strings in C
        6. Checking the ZeroMQ version
        7. Summary
      9. 2. Introduction to Sockets
        1. The publish-subscribe pattern
          1. Filtering out messages
          2. The socket options
            1. Subscription
            2. Unsubscription
          3. Notes on the publisher-subscriber pattern
        2. The pipeline pattern
          1. The divide and conquer strategy
          2. The ZMQ_PULL socket
          3. The ZMQ_PUSH socket
        3. Getting ZeroMQ context
        4. Destroying ZeroMQ context
        5. Cleaning up
        6. Detecting memory leaks
          1. Introduction to Valgrind
        7. Summary
      10. 3. Using Socket Topology
        1. What a socket is
        2. Types of Internet sockets
        3. Transmission Control Protocol (TCP)
          1. The three-way handshake protocol
        4. TCP header
          1. TCP flags
          2. Properties of TCP
        5. ZeroMQ sockets
          1. Differences between TCP sockets and ZeroMQ sockets
        6. Routing schemes
          1. Unicast
            1. Setting I/O threads and limiting the number of sockets
        7. Working with multiple sockets
        8. Working with multi-part messages
        9. How to handle interruptions
        10. Introduction to CZMQ
          1. zctx
          2. zstr_send
          3. zloop
          4. zmsg
          5. zfile
            1. zfile_mkdir
          6. zhash
          7. zlist
          8. zclock
          9. zthread
        11. Summary
      11. 4. Advanced Patterns
        1. Extending the request-reply pattern
        2. Writing multithreaded applications with ZeroMQ
        3. Wrapping publisher-subscriber messages
        4. High watermark
        5. Reliability
          1. Slow subscribers in a publish-subscribe pattern
        6. Summary
      12. A. Appendix
      13. Index