EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

RabbitMQ Architecture

By Priya PedamkarPriya Pedamkar

Home » Data Science » Data Science Tutorials » Data Analytics Basics » RabbitMQ Architecture

RabbitMQ Architecture

Introduction to RabbitMq Architecture

RabbitMQ is one of the most widely used open-source message brokers. It was originally based on the Advanced Message Queuing Protocol (AMQP). Later on, it has been modified to support Message Queuing Telemetry Transport (MQTT), Streaming Text Oriented Messaging Protocol (STOMP), and several other common protocols. In this topic, we are going to learn about RabbitMQ Architecture.

The main components of RabbitMQ are Producer, Exchange, Queue and Consumer. These are discussed in detail in the next section.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

RabbitMq Architecture

Producer Exchange Queue and Consumer

RabbitMQ comprises of the following parts:

1. Producer

A producer pushes messages to exchanges. Messages should not be pushed at a higher than that can be processed by the Consumers. It is also responsible for generating the routing keys.

2. Exchange

It is basically a routing rule for the messages. Now, for a message to travel to a queue or different exchange from the producers, it requires binding. Now different kinds of exchanges require different bindings. Some of the exchanges are:

Fanout Exchange

It routes messages to all the available queues without discrimination. A routing key, if provided, will simply be ignored. This exchange is useful for implementing the pub-sub mechanism. While using this exchange, different queues are allowed to handle messages in their own way, independently of others.

routed to all the queues

As shown in the diagram above, the messages are routed to all the queues.

Popular Course in this category
All in One Data Science Bundle (360+ Courses, 50+ projects)360+ Online Courses | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (3,220 ratings)
Course Price

View Course

Related Courses
Data Scientist Training (76 Courses, 60+ Projects)Machine Learning Training (17 Courses, 27+ Projects)Cloud Computing Training (18 Courses, 5+ Projects)
Direct Exchange

It routes messages on the basis of the routing key that the message carries. Routing Key is a short string generated by the Producer of the messages. The messages are routed to the exchanges/queues having the Binding Key that exactly matches the routing key.

Direct Exchange

As shown in the above diagram, the routing key is “Apples” and the messages are delivered to only one queue whose binding key is “Apples”

Topic Exchange

It routes messages on the basis of the complete or partial match with the routing key. In this case, the messages are published in such a way that the routing key consists of dot-separated series of words (like word1.word2.word3 ). Patterns can have an asterisk(*) that can match word at a certain location of the routing key or a hash that can match zero or more words.

RabbitMQ Architecture

In the above case, the routing key is “Apples.Oranges.Lemons” and the messages are routed to two queues: one having pattern as “*.Oranges.*” and others with the pattern “Apples.*”.

Headers exchange

Messages are routed based on the message headers. The message headers are matched against headers specified by binding queue and if matched then messages are sent to that queue. A special argument called “x-match” is added in the binding between an exchange and a queue. Now, this takes can have two values “any” or “all”, where “all” is the default value. “all” signifies that all header pairs must match, whereas “any” signifies that match must occur with at least one of the header pairs.

RabbitMQ Architecture

In the above case, messages are routed to one queue for which the “x-match” is set as “all” and all of its key-value pairs (only 1 in this case) match with that in the message header.

Consistent Hashing

This type of exchange hash either the routing key or the message header in order to route the messages to one queue only. This finds useful in cases where we have to guarantee that messages are Consumed in the same order as published.

3. Queue

It’s a buffer to store messages. Queues are named so that reference by applications is easier. Applications can decide the queue names or may ask the broker to generate them. Queue names can be up to 255 bytes of UTF-8 characters and cannot start with ‘amq.’ because such names are reserved by the broker for internal use. A queue is defined by the following properties:

  • Name
  • Durable (This queue can survive a broker restart and is achieved by persisting the queue to a disk. This doesn’t imply that messages are also durable)
  • Exclusive (Used by only one connection and gets deleted once that connection closes. If any other connection tries to access an Exclusive queue, it would throw a channel-level exception called RESOURCE_LOCKED)
  • Auto-Delete (The queue gets deleted automatically when the last consumer that subscribed to it unsubscribes)
  • Arguments (This is optional; Most of these arguments can be dynamically altered even after the queue has been declared. These can be set in two ways: a) To a group of queues using policies and b) On a per queue basis and the arguments are set when the client declares the queue)

Prior to using a queue, it needs to be declared. Declaring will cause a queue to be created if doesn’t already exist. Now, in case the queue already exists, then declaring will cause no effect if the attributes specified are the same as existing otherwise it will throw a channel-level exception called PRECONDITION-FAILED.

4. Consumer

It reads messages from the queues. Each consumer can set something called a pre-fetch limit (Otherwise known as QoS limit). This number indicates the number of unacknowledged messages the Consumer can handle at an instance.

Conclusion

RabbitMQ is widely used in the industry as it supports complex-routing. It has been adopted by many big companies/organizations like JP Morgan, NASA (for Nebula Cloud Computing) and Google. In fact, it also finds usage in India’s Aadhar Project, which is the largest biometric database in the world.

Recommended Articles

This is a guide to RabbitMQ Architecture. Here we discuss the basic meaning and main components of RabbitMQ such as Producer, Exchange, Queue and Consumer. You may also have a look at the following articles to learn more –

  1. RabbitMQ Alternatives
  2. Kafka Applications
  3. Kafka Architecture
  4. What is Kafka?

All in One Data Science Bundle (360+ Courses, 50+ projects)

360+ Online Courses

1500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Software Development Basics
  • Basics
    • Types of Algorithms
    • Vue.js?nextTick
    • Vue.js Transition
    • Page Replacement Algorithms
    • What is CLI
    • Open Source Software
    • Solve Problems With Technology (Simple)
    • What is Application Software & Types
    • System Software Tools
    • Typography App
    • Software as a Service (Saas)
    • Icon Font Pack
    • Interpret Results Using ANOVA Test
    • Blogging Insights Your Analytics
    • Increase Productivity Technology
    • Free Multimedia Software
    • Information Technology Benefits
    • What is SPSS and How Does It Work
    • Learn to Code For Beginners (Advance)
    • Uses of Coding
    • Uses Of Raspberry Pi
    • What Is System Design
    • Introduction to NLP
    • What is MapReduce
    • What is SoapUI
    • What is MVC
    • What is Multithreading
    • What is Elasticsearch
    • What is Neural Networks
    • What is Swift
    • What is PLC
    • What is Open Cart
    • What is XML
    • What is Mainframe
    • What is JMS
    • What is Cognos
    • What is Open Source
    • What is Bot
    • What is SOAP
    • What is COBOL
    • What is GraphQL
    • What is Microcontroller
    • What is Open-Source License
    • What is Visual Studio Code
    • What is Pandas
    • What is Hypervisor
    • What is Common Gateway Interface
    • What is IDE?
    • What is SSRS?
    • What is MVC Design Pattern
    • What is Application Server
    • What is GPS
    • What is NumPy
    • What is NLP
    • What is Botnet
    • What is Assembly Language
    • System Analysis And Design
    • HTTP Caching
    • What is Buffer Overflow
    • What is Ajax
    • What is Joomla
    • What is Appium
    • What is SVN
    • What is SPSS
    • What is WCF
    • What is Groovy
    • What is Clickbait
    • What is SOA
    • What is GUI
    • What is FreeBSD
    • What is WebSocket
    • What is WordPress
    • What is OSPF
    • What is Coding
    • CentOS Commands
    • What is Raspberry Pi
    • HTTP Cookies
    • What is Hub?
    • What is Bridge
    • What is Switch
    • What is Internet Application
    • What is Sensors
    • What is Proximity Sensors
    • What is Full Stack
    • System Design Interview Questions
    • What is Salesforce technology
    • What is Salesforce Sales Cloud
    • What is OOP
    • What is CMD
    • What is React
    • What is DSS
    • What is SVG
    • What is Apex
    • What is Desktop Software
    • Tor Browser, Anonymity and Other Browsers
    • Avoid Pitfalls of Shadow IT
    • Freelance Web Graphic Designer
    • What is Storage Virtualization
    • What is Web Services?
    • What is Social Networking?
    • What is Microservices Architecture?
    • Microservices Tools
    • Advantages of Microservices
    • Uses of Internet
    • Software Platforms
    • Uses of Internet for Business
    • Architecture of Web Services
    • Web Application Testing
    • Advantages of Web Service
    • CPU Virtualization
    • Types of Web Services
    • Web Services Testing
    • What is RabbitMQ?
    • RabbitMQ Architecture
    • Advantages of Bitcoin
    • Penetration Testing Services
    • Puppet Alternatives
    • What is Memcached?
    • What is Browser?
    • Types of Satellites
    • Model Driven Architecture
    • Types of Variables in Statistics
    • Integration Architecture
    • What is API Integration?
    • What is Grid Computing?
    • Asus File Manager
    • What is GPRS?
    • What is Gradle?
    • What is Basecamp?
    • Software System Architecture
    • GSM Architecture
    • What is Nagios?
    • AppDynamics Tool
    • Logical Architecture
    • What is Microsoft Planner
    • What is Circuit Switching
    • What is ARM?
    • Embedded Control Systems
    • Types of Embedded Systems
    • What is Bitbucket?
    • Requirement Engineering
    • What is WAP
    • What is Registry?
    • What is Dynatrace?
    • What is Digital Forensics?
    • Hardware Virtualization
    • AppDynamics Careers
    • Bandwidth Monitoring Tools
    • Ping Monitor Tools
    • Dynatrace Tools
    • What is Trello?
    • What is AppDynamics?
    • What is Remote Desktop?
    • What is Extranet?
    • What is LTE Network?
    • What is Firebase?
    • Website Monitoring Tool
    • Number Systems
    • Service Desk Manager
    • Static Website
    • Dynamic Website
    • What is Email?
    • What is URL Link?
    • What is Program?
    • What is Lock Screen?
    • What is Grafana
    • Unguided Media Transmission
    • IT Governance
    • IT Governance Framework
    • Remote Support Softwares
    • What is Unification?
    • Topological Map
    • What is LAMP?
    • USB Flash Drive
    • Software Development Models
    • Digital Circuit
    • What is Webpack?
    • Fault Tolerance
    • What is DSL Modem?
    • What is Mozilla Firefox?
    • What is Vagrant?
    • Types of Research Methodology
    • Grafana Plugins
    • Ionic Components
    • Nginx Version
    • RabbitMQ Routing Key
    • What is Svelte?
    • CakePHP
    • Telegram Features
    • What is CDN
    • RethinkDB
    • Symfony Version
    • CentOS add sudo user

Related Courses

Software Testing Training

Selenium Training Certification

Appium Training

JMeter Certification Training

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - All in One Data Science Bundle (360+ Courses, 50+ projects) Learn More