Book Image

Mastering RabbitMQ

By : Yusuf Aytas, Emrah Ayanoglu, Dotan Nahum
Book Image

Mastering RabbitMQ

By: Yusuf Aytas, Emrah Ayanoglu, Dotan Nahum

Overview of this book

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#.
Table of Contents (18 chapters)
Mastering RabbitMQ
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Message brokers and message queue


Recently, software systems evolved dramatically. Applications have to communicate with other applications, these applications can be internal and external to the application itself. For the same application, we may have different type of clients, such as browsers, mobile clients, and so on. Hence, we absolutely need a communication layer between internal applications and between applications and clients. We need to deliver different messages to different applications or clients. Delivering messages can be a bottleneck if the communication layer isn't scalable. Pursuing scalable systems for communication layer leads us to Message Brokers and Message Queues. Let's now discuss what Message Brokers and Message Queues are.

Message brokers

A Message Broker is an architectural pattern that can receive messages from multiple destinations, determine the correct destination, and route the message along the correct route, as stated in the book Enterprise Integration Patterns by Hohpe and Woolf. Message brokers enable systems to deal with messaging and routing by mediating communication among components. Once applications implement a message broker pattern, it decreases the coupling between application components.

Message Brokers are centralized, in the architectural sense, to control and manage all messages. Therefore, all of the incoming and outgoing messages are sent through Message Brokers, which analyze and deliver the messages to their correct destination. This procedural step can be understood with the following diagram:

Message Broker

Message Brokers address the following concerns in the communication layer:

  • Transforming messages to alternative formats

  • Routing messages to destinations

  • Supporting different types of patterns to send messages

  • Receiving and responding to events

  • Performing message aggregation

  • Persisting the message states

  • Ensuring the receiving and sending of message

  • Decoupling the destination software systems

Many tasks of the Message Broker need a Message Queue for exchanging or passing data to the destination. The next section covers Message Queues. We will talk about the mechanism behind Message Brokers in Chapter 3, Architecture and Messaging.

Message Queues

A Message Queue is, briefly, a queue for messaging. Queue is the basic data structure behind the functioning of a Message Queue. Message Queue operations are similar to Queue data structure operations, such as the enqueue and dequeu operations. An enqueue operation leads to adding an element to the back of the queue. A dequeue operation leads to the deletion of an element from the front of the queue.

Message Queues provide concurrent and asynchronous operations to scale applications. In a message queue, messages wait up until a message is retrieved by an application. Let's take a look at the following diagram:

Message Queue

Different types of standards and protocols define the Message Queuing specifications. Some protocols are open to everyone; however, some protocols are closed. Let's come back to our topic. RabbitMQ uses Advanced Message Queuing Protocol (AMQP) that determines the policies of the Message Queues. The next topic will cover detailed information on AMQP. Chapter 3, Architecture and Messaging, covers the detailed explanation of Message Queues.