Top Frequently asked Rabbitmq Interview Questions (2022)
RabbitMQ Interview Questions:
What is RabbitMQ?
How RabbitMQ works, and it's Standard message flow?
When and why to use RabbitMQ?
How to integrate RabbitMQ with Spring Boot?
What Is binding And routing Key?
What is a RabbitMQ channel?
How to implement RabbitMQ retry mechanism?
What is a dead letter queue in rabbitmq?
How to install and configure RabbitMQ at local?
What is Exchange?
Types of Exchange?
Which Protocol RabbitMQ uses?
How to integrate RabbitMQ with Spring Cloud Stream?
What is RabbitMQ Vhost?
How RabbitMQ differs from ActiveMQ?
Is RabbitMQ support MQTT (Message Queue Telemetry Transport)?
Is RabbitMQ persistent?
Is RabbitMQ uses database?
Does RabbitMQ is PUSH or PULL?
What is Dead Letter Exchange in Rabbitmq?
What is pub sub, how it works?
Is RabbitMQ an ESB?
Which design patterns RabbitMQ uses.
How to monitor rabbitMQ queue.
What is Synchronous and Asychronous messaging?
Which Messaging patterns are getting used in RabbitMq?
What is Point to Point Communication?
How RabbitMQ differs from Kafka?
What is Pub Sub Communication?
What is Request-Response communication?
What is Erlang RabbitMQ?
Is RabbitMQ support message priority queues?
RabbitMQ Tutorial :
Q: What is RabbitMQ?RabbitMQ is an open-source message-broker software is also known as message queueing
technology. It defines queues to which applications communicate for data transfer, or message
transmission. Any kind of information could be included in a message. This message is processed by
the recipient application.
Q: How RabbitMQ works, and it's Standard message flow? An exchange must accept messages from the supplier request and route them to message queues using
header attributes, bindings and routing keys. A binding is set up to connect the queue to an
As shown above in screen shot, below are the Standard message flow.
1) The producer publishes a message to an exchange. When you create the exchange, you have to specify the type of it. The different types of exchanges are explained in detail later on.
2) The exchange receives the message and is now responsible for the routing of the message. The exchange takes different message attributes into account, such as routing key, depending on the exchange type.
3) Bindings have to be created from the exchange to queues. In this case, we see two bindings to two different queues from the exchange. The Exchange routes the message into the queues depending on message attributes.
4) The messages stay in the queue until they are handled by a consumer
5) The consumer handles the message.
Q: When and why to use RabbitMQ? Message queueing is useful when you want to exchange a message for consumption or for balance of
loads between workers with multiple recipients. The user is able to take a message from the queue while
the producer is in the
queue, and start processing. The consumer can be on a different server or on the same server than the
publisher. The requested application can be of one language and the consumer application is of other
language - the message broker
would not care about the application languages, it just send messages between consumer and reciever.
Which also reduces the dependencies or coupling between the application.
Q: How to integrate RabbitMQ with Spring Boot?
Spring Boot + RabbitMQ Example
Q: What Is binding And routing Key?A binding is a "bridge" that you set up to connect a queue to an exchange.
The routing key is an attribute message that the exchange examines when determining how to route the message to queues.
Q: What is a RabbitMQ channel?
They enable you to have a single connection to the RabbiMQ server, but for different parts of your
application they have sandboxed communication.
Channels are how the RabbitMQ server communicates with your application. It hold one connection
(instance) per client process and many channels in that process (instance)
Q: What is a dead letter queue in rabbitmq?
In general, a death letter queue (DLQ), also referred to as an undelivered-message queue,
is a holding queue of messages that can not be sent to their destinations for some reason.
In rabbitmq, the dead letter queue is service implementation to store messages that satisfy one or more of the following failure criteria.
- Message that is sent to a queue that does not exist.
- Queue length limit exceeded.
- Message length limit exceeded.
- Message is rejected by another queue exchange.
- Message reaches a threshold read counter number, because it is not consumed. Sometimes this is called a "back out queue".
Q: How to implement RabbitMQ retry mechanism?
Whenever any data in the message is transmitted that the receiver does not accept, or when a message is sent to a queue that does not exist. The message is retried and sent up to a set number of times. Even if the communication is not received by the recipient but is sent from the sender's end. Now In such instances, the message queue is marked as undeliverable or deadLetter queue.
RabbitMQ provides a method for handling message failures in a really efficient way known as the Retry and Error Handling feature.
Q: How to install and configure RabbitMQ at local?
Q: What is Exchange? Messages are not posted directly in the queue; rather, the user sends messages to the exchange. An
exchange is responsible for routing the messages to the various queues. An exchange receives messages
from the producer request
and routes them by bindings and routing keys to message queues. A binding is a linkage between an
exchange and a queue.
Q: Types of Exchange?
Direct: Direct exchange transfers messages to queues on the basis of a message routing key. The message is routed in a direct exchange to the queues whose binding key exactly matches the message's routing key. If the queue is bound to the binding key exchange, a message will be sent to the exchange with a routing key to the queue.
Fanout: A fanout sends messages to all the queues linked to it.
Topic: The topic exchange matches the wildcard between the routing key and the binding routing pattern. Headers: Headers exchanges use the routing attributes of the message header.
Q: Which Protocol RabbitMQ uses?
RabbitMQ uses Advanced Message Queuing Protocol (AMQP). Its an open standard layer used to communicates
date across network by means of byte stream.
Q: How to integrate RabbitMQ with Spring Cloud Stream?
RabbitMQ with Spring Cloud Stream
Q: What is RabbitMQ Vhost?
A Virtual Host (a.k.a. ' vhost ') in AMQP is a namespace for objects such as Exchanges,
Queues and Bindings. RabbitMQ utilizes more concrete implementation of virtual hosts, through
effectively making them "virtual
clusters" on top of the broker.
Q: How RabbitMQ differs from ActiveMQ?
RabbitMQ is open source message broker with support for several protocols, written in Erlang. Whereas
ActiveMQ is also open source with support for several protocols, written in Java langauge.
Q: Is RabbitMQ support MQTT (Message Queue Telemetry Transport)?
RabbitMQ supports MQTT 3.1.1 through a plugin that ships to the core distribution.
Supported MQTT Features:
- QoS0 and QoS1 publish & consume
- QoS2 publish (downgraded to QoS1)
- Session stickiness
- Retained messages with pluggable storage backends
- Last Will and Testament (LWT)
Checkout our related posts :
Q: Is RabbitMQ persistent?
Having a queue durable is not same as making persistent messages. Messages can be distributed either
with making mode to persistent or transient. When you post your message, you need to set the delivery
mode to persistent if you want it to remain in your
long-lasting queue during restart.
Q: Is RabbitMQ uses database?
RabbitMQ intentionally does not store messages in a database. RabbitMQ writes messages to disk in below
- Messages published in delivery_mode=2
- Memory pressure causes RabbitMQ to run out of RAM and transfers messages to the disk to free up RAM.
Q: Does RabbitMQ is PUSH or PULL?
RabbitMQ uses a PUSH template and prevents exhausting consumers through the prefetch configured limit.
PULL is used by Kafka, where consumers request for messages from a particular offset batches.
Q: What is Dead Letter Exchange in Rabbitmq?
If there is no appropriate queue for the message, the message will be dropped quietly. RabbitMQ offers
an AMQP extension known as the "Dead Letter Exchange". The dead letter exchange provides features for
collecting non-deliverable messages.
Q: What is pub sub, how it works?pub/sub messaging is a asynchronous
service-to-service communication, it's a two way communication.
Mainly used in statelss, microservices. In this type of model, once message published to a topic, it gets received immediately by all subscriber to the topic.
Q: Is RabbitMQ an ESB?
RabbitMQ is a messaging broker, whereas Mule is an ESB (Enterprise Service Bus). An ESB includes
additional layers on top of a message broker like routing, transformations and business process
Q: Which design patterns RabbitMQ uses. As a strong messaging model transmitting
messages among endpoints in the communication channel has many features / uses. It uses asynchronous
architectural patterns to decouple
Q: How to monitor rabbitMQ queue.Monitoring is a process of capturing behaviour of
your application using health checks and metrics.
There are many tools available to monitors the application like AppDynamics,DataDog,AWS CloudWatch etc.
Q: What is Synchronous and Asychronous messaging.Synchronous messaging is a two way
communication, where sender sends a message to receiver and receiver receives message and gives reply to
the sender. Where as Asynchronous
Messaging is a communication where a message is placed in a message queue and does not require an
immediate response from receiver.
Q: Which Messaging patterns are getting used in RabbitMq?Messaging patterns are
implemented in RabbitMQ on the basis of exchanges queues and bindings. We may distinguish between the
different approaches to implementing
a RabbitMQ design pattern: point-to-point communication publish-subscribe request-response communication
Q: What is Point to Point Communication? Point-to-point connection is a communications
connection between two communication endpoints/nodes.
Q: How RabbitMQ differs from Kafka?
RabbitMQ is a lightweight message broker used to communicates messages between consumer and producer and
it supports many protocols like AMQP, MQTT,STOMP. Whereas Kafka manages large amounts of data with very
little overhead-Kafka was designed for large
volumes of messages to be stored and distributed.
Refer Apache Kafka Tutorial to understand Kafka with example.
Q: What is Pub Sub Communication? Pub / sub messaging is a two-way communication
between asynchronous user and service., mainly used in stateless microservices.
Q: What is Request-Response communication?Request–Response, or Request–Reply,is
strong messaging patterns where requester send message to a replier, and in return replier send response
back to replier.
Q: What is Erlang RabbitMQ?The RabbitMQ server software is written in the programming
language of Erlang and is based on the clustering and failover architecture of the Open Telecom
Q: Is RabbitMQ support message priority queues? To make the queue function as a
priority queue, provide an
x-max-priorityproperty when the queue is established.
x-max-prioritydeclares the maximum priority number in the queue.
In JavAns: Set priority as given below:
Publish messages of a particular priority,
Map<String, Object> queuePriorityProp = new HashMap<>(); queuePriorityProp.put("x-max-priority", 10); // max priority is 10 channel.queueDeclare(QUEUE_NAME, durable, false, false, queuePriorityProp);
String queueNote = "Set note priority 8"; AMQP.BasicProperties.Builder queueProps = new AMQP.BasicProperties.Builder(); queueProps.contentType("text/plain") .priority(8); channel.basicPublish("", QUEUE_NAME, queueProps.build(), queueNote.getBytes());