More and more companies are adapting to Microservices due to reliability and scalability. Software architectures are rethinking their system designs, monolithic applications are evolving into microservices and infrastructures are moving to cloud. Messaging is undoubtedly an important facet of any microservice architecture. RabbitMQ is a message broker (message queuing software) used to exchange data between processes, applications, systems or servers.

Messaging is not new in Java world, developers have been using it with the help of JMS in Java. However, JMS is not truly interoperable as it is tightly coupled with the JVM and Java world. Big Organisations like JP Morgan, CISCO, Microsoft, RedHat, etc came together to create a truly interoperable messaging standard known as AMQP (Advanced Message Queuing Protocol). AMQP is one of the protocols RabbitMQ supports.

A Message broker is an agent who guarantees the message delivery. The rules a message broker understands is known as messaging protocol.

What is RabbitMQ?

RabbitMQ is an open-source message broker, licensed under the MPL 1.1. It is part of Pivotal software Inc (now owned by VMware). It has several features and benefits as listed below. It is popular in startups as well as big organizations.

RabbitMQ is written in Erlang, designed for a distributed, fault-tolerant, soft real-time systems with almost 99.999% uptime.

Advantages of RabbitMQ:

  1. Reliable Messaging: Ensures that messages are delivered without loss, even if some parts of the system fail.
  2. Flexible Routing: Can route messages in many different ways, making it adaptable to different needs.
  3. Scalable: Can handle increasing amounts of messages and users by adding more resources.
  4. Supports Multiple Protocols: Works with different messaging protocols, making it versatile. AMQP, STOMP, MQTT, HTTP, WebSockets, SMTP
  5. Easy to Use: Has a user-friendly interface and extensive documentation, making it accessible for developers.

Protocols Supported by RabbitMQ

RabbitMQ is versatile because it supports multiple messaging protocols. Here are the key protocols it supports:

  • AMQP (Advanced Message Queuing Protocol):
    • The primary protocol used by RabbitMQ.
    • Designed for message-oriented middleware.
    • Provides robust messaging features like reliable delivery, routing, and security.
  • AMQP 1.0:
    • A different version of AMQP that is more interoperable across different systems.
    • Ensures compatibility with various AMQP 1.0 clients.
  • STOMP (Simple (or Streaming) Text Oriented Messaging Protocol):
    • A simple and easy-to-implement text-based protocol.
    • Often used for integrating with web-based messaging systems and applications.
  • MQTT (Message Queuing Telemetry Transport):
    • A lightweight messaging protocol.
    • Ideal for constrained environments, such as IoT (Internet of Things) devices and mobile applications.
  • HTTP:
    • Supports basic HTTP for management and monitoring through its web-based management UI.
    • Plugins are available to support RESTful HTTP APIs for messaging.
  • WebSockets:
    • Provides a full-duplex communication channel over a single, long-lived TCP connection.
    • Useful for real-time web applications, allowing messages to be sent and received in web browsers.
  • SMTP (Simple Mail Transfer Protocol):
    • While not a primary messaging protocol for RabbitMQ, it can interact with email systems through plugins or custom integrations.

By supporting these protocols, RabbitMQ can integrate with a wide range of applications and systems, making it a flexible choice for various messaging needs.

Features and benefits of RabbitMQ

  • Open Source – Released under Mozilla Public License 1.1.
  • Multiple message protocols – AMQP, MQTT, STOMP, HTTP.
  • Lightweight – A single instance can run in less than 40MB of RAM.
  • Client library support – All modern programming languages like Java, Python, JavaScript, Erlang, etc today have RabbitMQ client library.
  • Third-party plugins support – Provides flexible plugins system for third party plugins. e.g. plugins for persisting messages into databases.
  • Highly Scalable architecture – Easily deploy a cluster of RabbitMQ.
  • Enterprise and Cloud-ready – Flexible enough to deploy on-premise infrastructure or in cloud infra.
  • Management & Monitoring – HTTP-API, command-line tool, and UI for managing and monitoring.
  • Tools support – Works with major CI/CD tools and can deploy with BOSH, Chef, Docker, and Puppet.

Who is using RabbitMQ?

  • Google uses RabbitMQ in their several products. Google Cloud Platform also offers RabbitMQ.
  • NASA is using RabbitMQ in its Nebula SaaS platform.
  • BBC uses it for the real-time news feed.
  • Reddit uses in its core application.
  • Mozilla uses RabbitMQ in Pulse.
  • JPMorgan sends 1 billion AMQP messages per day.

In today’s world, RabbitMQ is used in startups to big size organizations.

What is AMQP – Advanced Message Queuing Protocol?

AMQP is a standard protocol for interoperability between messaging middleware. ISO and IEC approved OASIS AMQP 1.0 (Advanced Message Queuing Protocol) as an International Standard. AMQP has 2 major components, AMQP-client library, and AMQP server. Irrespective of the language in which AMQP-server is written, the AMQP-client library can be written in any programming language.

The Advanced Message Queuing Protocol (AMQP) is an open standard for passing business messages between applications or organizations.  It connects systems, feeds business processes with the information they need and reliably transmits onward the instructions that achieve their goals.

AMQP official doc

If you have read my articles on JMS, I clearly mentioned the limitations of JMS such as Security, Scalability, etc. But AMQP is designed to eliminate such limitations.

AMQP was designed with the following main characteristics as goals: Security, Reliability, Interoperability, Open standard.

Products supporting AMQP

A standard is of no use without products, and there is an excellent list of AMQP supported message brokers. RabbitMQ was one of the earliest to implement AMQP specification.

RabbitMQ vs JMS

  • Technology:
    • RabbitMQ: Uses the Advanced Message Queuing Protocol (AMQP), which is a protocol specifically designed for messaging.
    • JMS (Java Message Service): An API for Java that works with various messaging systems, not a messaging system itself.
  • Language:
    • RabbitMQ: Written in Erlang, and supports multiple programming languages.
    • JMS: Primarily used with Java applications.
  • Flexibility:
    • RabbitMQ: More flexible with message routing and supports multiple protocols.
    • JMS: More standardized for Java applications but less flexible in routing options.

RabbitMQ vs Kafka

  • Use Case:
    • RabbitMQ: Best for complex routing and tasks where you need to process each message individually, like order processing systems.
    • Kafka: Best for handling large volumes of data and real-time streaming, like logging or tracking events.
  • Message Handling:
    • RabbitMQ: Pushes messages to consumers, meaning it sends messages as they arrive.
    • Kafka: Consumers pull messages from Kafka when they are ready, giving more control over message processing.
  • Scalability:
    • RabbitMQ: Scales well for moderate message volumes and complex routing.
    • Kafka: Designed to handle very high message volumes and offers superior scalability for big data applications.

References:

Conclusion:

The key take ways are, a message broker is like an agent who guarantees message delivery to the destination. AMQP 1.0 is an open standard for messaging protocol, RabbitMQ is one of the most popular open-source messaging middleware that supports AMQP.

By |Last Updated: May 22nd, 2024|Categories: RabbitMQ|

Table of Contents