Mastering RabbitMQ

Book description

Master the art of developing message-based applications with RabbitMQ

About This Book

  • Learn how to administer, manage, and extend your own message broker, RabbitMQ
  • Develop clients to make a message bridge between your software systems using RabbitMQ
  • Discover how to achieve proficiency with RabbitMQ with the well-defined descriptions of the topics

Who This Book Is For

If you are an intermediate-level RabbitMQ developer, who wants to achieve professional-level expertise in the subject, this book is for you. You'll also need to have a decent understanding of message queuing.

What You Will Learn

  • Administer RabbitMQ using different tools
  • Understand the roots and details of messaging, message brokers, and AMQP protocol
  • Scale the RabbitMQ server using the clusters and high availability techniques
  • Extend RabbitMQ by developing the Erlang OTP-based applications that use the RabbitMQ API
  • Manage the RabbitMQ server using its powerful tools
  • Monitor the RabbitMQ Server using different open source tools such as Nagios, Munin, and Zabbix
  • Ensure your RabbitMQ's security using SSL, SASL, and access control
  • Develop RabbitMQ clients using Java, Python, and C# with an industry example

In Detail

RabbitMQ is one of the most powerful Open Source message broker software, which is widely used in tech companies such as Mozilla, VMware, Google, AT&T, and so on. RabbitMQ gives you lots of fantastic and easy-to-manage functionalities to control and manage the messaging facility with lots of community support. As scalability is one of our major modern problems, messaging with RabbitMQ is the main part of the solution to this problem.

This book explains and demonstrates the RabbitMQ server in a detailed way. It provides you with lots of real-world examples and advanced solutions to tackle the scalability issues.

You'll begin your journey with the installation and configuration of the RabbitMQ server, while also being given specific details pertaining to the subject. Next, you'll study the major problems that our server faces, including scalability and high availability, and try to get the solutions for both of these issues by using the RabbitMQ mechanisms. Following on from this, you'll get to design and develop your own plugins using the Erlang language and RabbitMQ's internal API. This knowledge will help you to start with the management and monitoring of the messages, tools, and applications. You'll also gain an understanding of the security and integrity of the messaging facilities that RabbitMQ provides. In the last few chapters, you will build and keep track of your clients (senders and receivers) using Java, Python, and C#.

Style and approach

An easy-to-follow guide, full of hands-on examples based around managing, monitoring, extending, and securing RabbitMQ and its internal tools. You will learn how to develop your own clients using Java, Python, and C#.

Table of contents

  1. Mastering RabbitMQ
    1. Table of Contents
    2. Mastering RabbitMQ
    3. Credits
    4. About the Authors
    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. Message brokers and message queue
        1. Message brokers
        2. Message Queues
      2. An introduction to the advanced message queue protocol
      3. An overview of RabbitMQ
      4. Installation of RabbitMQ
        1. Windows
        2. Mac OS X
        3. Ubuntu
        4. Fedora
        5. Amazon elastic compute cloud (EC2)
      5. Starting RabbitMQ
        1. Starting RabbitMQ on Windows
        2. Other OSes (Linux, Mac OS X)
      6. Summary
    9. 2. Configuring RabbitMQ
      1. Overall configuration of RabbitMQ
      2. The RabbitMQ environment variables
        1. Common environment variables
        2. Unix-specific default location
        3. Windows-specific default location
      3. The configuration file
      4. Runtime parameters
        1. Parameter management
        2. Policy management
        3. Memory management
      5. Summary
    10. 3. Architecture and Messaging
      1. Messaging and its use cases
        1. Coupling of the software systems
          1. Heterogeneous integration
          2. Addressing scalability
      2. Enterprise messaging
      3. Messaging-related software architectures
        1. Message oriented middleware – Architecture
        2. Event-driven architecture
      4. Messaging concepts
        1. Message producers
        2. Message brokers
        3. Message consumers
        4. Messages
      5. Advanced Message Queuing Protocol (AMQP)
        1. AMQ elements
          1. Message flow
          2. Exchanges in AMQ
          3. Message queues
          4. Bindings
        2. Functional specifications of AMQP
          1. AMQP messages
          2. Virtual hosts
          3. Exchange types
            1. The direct exchange type – amq.direct
            2. The fan-out exchange type – amq.fanout
            3. The topic exchange type – amq.topic
            4. The headers exchange type – amq.match
      6. Summary
    11. 4. Clustering and High Availability
      1. High reliability in RabbitMQ
        1. Federation in RabbitMQ
        2. Clustering in RabbitMQ
        3. Creating clusters
        4. Checking the cluster status
        5. Changing the cluster node types
        6. Updating cluster nodes
        7. Clustering the settings of RabbitMQ
        8. Load balancing for high availability of queues
      2. Summary
    12. 5. Plugins and Plugin Development
      1. Plugin management and default plugins
        1. Enabling and disabling plugins
        2. Installing plugin from third-party sources
        3. Default plugin list
      2. Plugin configuration
      3. Custom plugin development
        1. Basics of Erlang
          1. Variables and expressions
          2. Tuples and lists
          3. Functions and modules
          4. Conditionals
          5. Looping in Erlang
          6. Concurrent programming
        2. Simple RabbitMQ metronome plugin
      4. Summary
    13. 6. Managing Your RabbitMQ Server
      1. Management via a command line
        1. Cluster commands
        2. User commands
        3. Virtual host and permission commands
        4. Miscellaneous commands
      2. Management via a web plugin
      3. Management via a REST API
      4. Summary
    14. 7. Monitoring
      1. RabbitMQ command-line tools
      2. Web plugins
      3. Nagios
      4. Munin
      5. Zabbix
      6. Summary
    15. 8. Security in RabbitMQ
      1. An brief introduction to security in RabbitMQ
        1. Vulnerabilities
          1. Information leakage
          2. Session management
          3. Authentication and authorization
        2. Solutions to the vulnerabilities
          1. Fixing information leakage
          2. Session management
          3. Authentication and authorization
      2. Applying access control
      3. Providing SASL authentication
      4. SSL support in RabbitMQ
        1. Keys, certificates, and CA certificates
        2. Enabling SSL support
      5. Summary
    16. 9. Java RabbitMQ Client Programming
      1. Case study
        1. Use cases
        2. Interaction diagram – sequence diagram
      2. Application language – Java
        1. Java Message Service (JMS)
      3. RabbitMQ Java client API
        1. Client package in detail
          1. Connection
          2. Channel
          3. Exchanges
          4. Queues
          5. Publishing messages
          6. Consuming messages
            1. Synchronously receiving messages
            2. Asynchronously receiving messages
      4. Case study – client implementations
        1. Model classes
          1. JSONMessage interface
          2. Message model
          3. File message
          4. Task
        2. Single message
          1. Sender
          2. Receiver
        3. Group message – routing
          1. Sender
          2. Receiver
        4. Bulk message – PubSub
          1. Sender
          2. Receiver
        5. File message
          1. Sender
          2. Receiver
        6. RPC message
          1. RPC client
          2. RPC server
        7. Creating tasks – manual acknowledgment
          1. Task creator
          2. Task handler
        8. Creating distributing tasks
          1. Task creator
          2. Task handler clients
      5. Spring framework and RabbitMQ
      6. Spring AMQP
        1. Single message
          1. Spring config
          2. Sender
          3. Receiver
        2. PubSub messages
          1. Spring config
        3. Private messages – routing
          1. Spring config
      7. Summary
    17. 10. Ruby Client Programming
      1. Case study
        1. Small data
        2. Big data
        3. Medium data
        4. Solving all data problems
      2. Bunny and Ruby
      3. Installing Ruby
        1. Linux
        2. Windows
        3. OSX/Mac
        4. Rbenv
        5. Installing Bunny
      4. Using Bunny
        1. Bunny producer
        2. Bunny consumer
      5. Exploring the AMQP model with Bunny
        1. Workers
        2. Publish – subscribe
        3. Routing
      6. The real-time processing
      7. Sneakers
        1. Installing
        2. Lambda architecture
        3. The real-time processors
          1. Key performance indicators (KPIs)
        4. Building averaging workers
          1. Windows
          2. Linux
          3. Mac OS X
        5. Building the IP2Location worker
        6. Exploring sneakers
        7. Timeouts
        8. Job handling
        9. Metrics
      8. Summary
    18. 11. Python Client Programming
      1. Case study
        1. Getting Python dependencies
      2. Pika
        1. Installing Pika
        2. Our first Pika client
        3. A consumer
      3. Introducing the web scraper
        1. Scheduler
        2. Scraper
      4. Implementing the scheduler
      5. Implementing the scraper
        1. Running the scraper
      6. Handling failure
      7. Using acknowledgement
      8. The Pika API
        1. Connecting
        2. Using connection adapters
          1. BlockingConnection
          2. BlockingChannel
        3. Declaring queues and exchanges
        4. Authentication
          1. Plain credentials
          2. SSL and external credentials
          3. Certificate authentication
        5. Background processing
      9. Celery
        1. Installation
        2. Celery scraper
        3. Celery scheduler
        4. Exploring Celery
          1. Scheduling
          2. HTTP hook tasks
          3. Other Celery features
      10. Summary
    19. Index

Product information

  • Title: Mastering RabbitMQ
  • Author(s): Emrah Ayanoglu, Yusuf Aytaş, Dotan Nahum
  • Release date: January 2016
  • Publisher(s): Packt Publishing
  • ISBN: 9781783981526