You are previewing Learning RabbitMQ.
O'Reilly logo
Learning RabbitMQ

Book Description

Build and optimize efficient messaging applications with ease

About This Book

  • Learn to administer, configure, and manage RabbitMQ instances

  • Discover ways to secure and troubleshoot RabbitMQ instances

  • This book is fully up-to-date with all the latest changes to version 3.5

  • Who This Book Is For

    If you are a developer or system administrator with a basic knowledge of messaging who wants to learn RabbitMQ, or if you want to further enhance your knowledge in working with the message broker, then this book is ideal for you. To fully understand some examples in the book, a basic knowledge of the Java programming language is required.

    What You Will Learn

  • Apply messaging patterns using the message broker

  • Administer RabbitMQ using the command line, management Web console, or management REST services

  • Create a cluster of scalable, and highly-available, RabbitMQ instances

  • Use RabbitMQ with the Spring Framework, MuleESB, WSO2, and Oracle databases

  • Deploy RabbitMQ using Puppet, Vagrant, or Docker

  • Fine-tune the performance of RabbitMQ

  • Monitor RabbitMQ using Nagios, Munin, or Monit

  • Secure, troubleshoot, and extend RabbitMQ

  • In Detail

    RabbitMQ is Open Source Message Queuing software based on the Advanced Message Queue Protocol Standard written in the Erlang Language. RabbitMQ is an ideal candidate for large-scale projects ranging from e-commerce and finance to Big Data and social networking because of its ease of use and high performance. Managing RabbitMQ in such a dynamic environment can be a challenging task that requires a good understanding not only of how to work properly with the message broker but also of its best practices and pitfalls.

    Learning RabbitMQ starts with a concise description of messaging solutions and patterns, then moves on to concrete practical scenarios for publishing and subscribing to the broker along with basic administration. This knowledge is further expanded by exploring how to establish clustering and high availability at the level of the message broker and how to integrate RabbitMQ with a number of technologies such as Spring, and enterprise service bus solutions such as MuleESB and WSO2. We will look at advanced topics such as performance tuning, secure messaging, and the internals of RabbitMQ. Finally we will work through case-studies so that we can see RabbitMQ in action and, if something goes wrong, we'll learn to resolve it in the Troubleshooting section.

    Style and approach

    Each chapter of the book is an easy-to-follow guide that expands and builds on the knowledge already gained in previous chapters. Throughout the course of the book, a sample system called the CSN (Corporate Social Network) is used to illustrate the core principles described. At the end of each chapter, there is a Q&A session that covers practical questions that may arise in practice when working with RabbitMQ.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Learning RabbitMQ
      1. Table of Contents
      2. Learning RabbitMQ
      3. Credits
      4. About the Author
      5. About the Reviewers
        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. Introducing RabbitMQ
        1. Enterprise messaging
          1. Use cases
          2. Solutions
          3. Patterns
            1. Point-to-point
            2. Publish-subscribe
            3. Request-response
        2. Understanding RabbitMQ
          1. Features
          2. Comparison with other technologies
          3. Installation
            1. Linux
        3. Case study: CSN (Corporate Social Network)
        4. Summary
        5. Exercises
      9. 2. Design Patterns with RabbitMQ
        1. Messaging patterns in RabbitMQ
        2. Point-to-point communication
        3. Publish-subscribe communication
        4. Request-reply communication
        5. Message router
        6. Case study: Initial design of the CSN
        7. Summary
        8. Exercises
      10. 3. Administration, Configuration, and Management
        1. Administering RabbitMQ instances
          1. Administering RabbitMQ components
          2. Administering users
          3. Administering vhosts
          4. Administering permissions
          5. Administering exchanges
          6. Administering queues
          7. Administering bindings
          8. Administering policies
          9. Administering the RabbitMQ database
          10. Full backup and restore
          11. Backing up and restoring the broker metadata
        2. Installing RabbitMQ plugins
        3. Configuring RabbitMQ instances
          1. Setting environment variables
          2. Modifying the RabbitMQ configuration file
        4. Managing RabbitMQ instances
        5. Upgrading RabbitMQ
          1. Case study: Administering CSN
        6. Summary
        7. Exercises
      11. 4. Clustering
        1. Benefits of clustering
        2. RabbitMQ clustering support
          1. Creating a simple cluster
          2. Adding nodes to the cluster
          3. Adding RAM-only nodes to the cluster
          4. Removing nodes from a cluster
          5. Connecting to the cluster
        3. Case study: scaling the CSN
        4. Summary
        5. Exercises
      12. 5. High Availability
        1. Benefits of high availability
        2. High availability support in RabbitMQ
          1. Mirrored queues
          2. Federation plugin
          3. Shovel plugin
          4. Reliable delivery
            1. AMQP transactions
            2. Publisher confirms
        3. Client high availability
          1. Client reconnections
          2. Load balancing
        4. Case study: introducing high availability in CSN
        5. Summary
        6. Exercises
      13. 6. Integrations
        1. Types of integrations
          1. Spring framework
            1. Spring AMQP
            2. Spring Integration
          2. Integration with ESBs
            1. Mule ESB
            2. WSO2
          3. Integration with databases
            1. Oracle RDBMS
            2. MongoDB
            3. Hadoop
        2. RabbitMQ integrations
        3. RabbitMQ deployment options
          1. Puppet
          2. Docker
          3. Vagrant
        4. Testing RabbitMQ applications
          1. Unit testing of RabbitMQ applications
          2. Integration testing of RabbitMQ applications
        5. Case study: Integrating CSN with external systems
        6. Summary
        7. Exercises
      14. 7. Performance Tuning and Monitoring
        1. Performance tuning of RabbitMQ instances
          1. Memory usage
          2. Faster runtime execution
          3. Message size
          4. The maximum frame size of messages
          5. The maximum number of channels
          6. Connection heartbeats
          7. Clustering and high availability
          8. QoS prefetching
          9. Message persistence
          10. Mnesia transaction logs
          11. Acknowledgements, transactions and publisher confirms
          12. Message routing
          13. Queue creation/deletion
          14. Queue message TTL
          15. Alarms
          16. Network tuning
          17. Client tuning
          18. Performance testing
        2. Monitoring of RabbitMQ instances
          1. The management UI
          2. Nagios
          3. Monit
          4. Munin
        3. Comparing RabbitMQ with other message brokers
        4. Case Study : Performance tuning and monitoring of RabbitMQ instances in CSN
        5. Summary
        6. Exercises
      15. 8. Troubleshooting
        1. General troubleshooting approach
          1. Checking the status of a particular node
          2. Inspecting the RabbitMQ logs
          3. The RabbitMQ mailing list and IRC channel
          4. Erlang troubleshooting
            1. An Erlang Primer
            2. The Erlang crash dump
        2. Problems with starting/stopping RabbitMQ nodes
        3. Problems with message delivery
        4. Summary
        5. Exercises
      16. 9. Security
        1. Types of threats
        2. Authentication
          1. Configuring the LDAP backend
          2. Security considerations
        3. Authorization
          1. LDAP authentication
        4. Secure communication
          1. Secure communication with the management interface
          2. Secure cluster communication
          3. EXTERNAL SSL authentication
        5. Penetration testing
        6. Case study – securing CSN
        7. Summary
        8. Exercises
      17. 10. Internals
        1. High level architecture of RabbitMQ
        2. Overview of RabbitMQ components
          1. Boot component
          2. Plug-in loader component
          3. Recovery component
          4. Persistence component
            1. Metadata persistence
            2. Message persistence component
          5. Networking component
          6. Other components
          7. Developing plug-ins for RabbitMQ
        3. Case Study: Developing a RabbitMQ plugin for CSN
        4. Summary
        5. Exercises
      18. A. Contributing to RabbitMQ
        1. RabbitMQ community
        2. RabbitMQ repositories
          1. Getting the sources
          2. Building the RabbitMQ server
        3. Points for contribution
      19. Index