Most frequently asked RabbitMQ Interview Questions
- What is RabbitMQ?
- How to verify the version of RabbitMQ?
- What are the different types of exchange types in RabbitMQ?
- What is the difference between Channel and Connection in RabbitMQ?
- What ports does RabbitMQ use?
- How to delete all queues in RabbitMQ ?
- What is Exchange?
- What is a Server in Rabbitmq?
- Which Protocol RabbitMQ uses?
- How can we delete all the queues from RabbitMQ?
- What ports does RabbitMQ use?
- How can we verify RabbitMQ version?
- What is rabbitmqadmin?
- Name some client Libraries supported by RabbitMQ?
- Is RabbitMQ support message priority queues?
- What is ZeroMQ?
- How do we stop the RabbitMQ server on localhost?
- How to restart RabbitMQ service?
- What is Apache Qpid?
What is RabbitMQ ?
RabbitMQ is an open-source message-broker software that originally implemented the Advanced Message Queuing Protocol and has since been extended with a plug-in architecture to support Streaming Text Oriented Messaging Protocol, MQ Telemetry Transport, and other protocols.How to verify the version of RabbitMQ?
sudo rabbitmqctl status
What are the different types of exchange types in RabbitMQ?
RabbitMQ has following types of Exchanges-- Direct helps in transfering the messages to the queues on the basis of message routing key.
- Fanout helps in sending messages to all the queues that are linked with it.
- Topic helps in exhanging matches between the routing key and the binding routing pattern.
- Headers helps in exchanging the routing attributes of the message headers.
How to implement RabbitMQ Cloud publisher?
RabbitMQ has following types of Exchanges-- Direct helps in transfering the messages to the queues on the basis of message routing key.
- Fanout helps in sending messages to all the queues that are linked with it.
- Topic helps in exhanging matches between the routing key and the binding routing pattern.
- Headers helps in exchanging the routing attributes of the message headers.
In this tutorial we will be implementing Rabbitmq Cloud Publisher with the help of a simple example.
Spring cloud Stream is a framework by which message-driven or event-driven microservices can be created. This microservice are then connected using a message-broker. Rabbitmq is a type of message-broker which helps to communicate between the microservices.It uses the concept of Advanced Message Queuing Protocol(AMQP).
The digrammatic representation between the message publisher and the Rabbitmq message broker is as follows-
Spring Boot + Rabbitmq Cloud Publisher Example
What is the difference between Channel and Connection in RabbitMQ?
Channel | Connection |
---|---|
Real TCP connection to the message broker | Virtual connection |
What ports does RabbitMQ use?
PORT | Usage |
---|---|
4369 | Port Mapper Daemon (epmd) for resolution of node names in a cluster |
35197 | set by inet_dist_listen_min/max |
15672, 55672, 5672 | RabbitMQ Management console |
How to delete all queues in RabbitMQ ?
rabbitmqctl stop_app rabbitmqctl reset rabbitmqctl start_app
How to implement RabbitMQ retry mechanism?
spring: rabbitmq: listener: simple: retry: enabled: true initial-interval: 6s max-attempts: 5 max-interval: 15s multiplier: 4
Spring Boot + RabbitMQ - Error Handling Example
What is Exchange?
Messages is not posted directly in the queue, the user sends messages to the exchange, it is responsible for routing the messages to the queues.Exchange helps in receiving messages from the producer request and routes them by bindinga and routings keys for messaging queues.It acts like a bindage, linking between an exhange and a queue.
What is a Server in Rabbitmq?
RabbitMQ Servers are robust and scalable implementation of AMQP broker, it helps in displaying a banner messages and reports on the progress in the startup sequence with the message Broker Running, that indicates the RabbitMQ broker has been started successfully.Which Protocol RabbitMQ uses?
RabbitMQ uses AWQP(Advanced Message Queuing Protocol) that is an open standard layer and uses to communicate date across network by means of byte stream.How can we delete all the queues from RabbitMQ?
For deleting the queues we can use the following codes:rabbitmqadmin list queues name
rabbitmqadmin delete queue name='queuename'
rabbitmqctl stop_app rabbitmqctl reset # Be sure you really want to do this! rabbitmqctl start_app
What ports does RabbitMQ use?
RabbitMQ Management console:PORT 15672 for RabbitMQ version 3.x
PORT 55672 for RabbitMQ pre 3.x
SERVER_ERL_ARGS="+K true +A30 +P 1048576 \ -kernel inet_default_connect_options [{nodelay,true}] \ -kernel inet_dist_listen_min 35197 \ -kernel inet_dist_listen_max 35197"
How can we verify RabbitMQ version?
sudo rabbitmqctl status
What is rabbitmqadmin?
Rabbitmqadmin helps in performing the same actions as the Web based UI, it can be shipped with the management plugin and also provides a convenient way for automating tasks,This tool helps in supporting all versions of Python and also can be downloaded after the management plugin is installed.List some client Libraries supported by RabbitMQ?
The following client Libraries supported by RabbitMQ are :RabbitMQ JMS Client
RabbitMQ .NET Client
RawRabbit
Bunny
March Hare
Pika & aio-pika
Aio-amqp
Php-amqplib
Amqp.node
Is RabbitMQ support message priority queues?
We can Set priority as given below:Map<String, Object> queuePriorityProp = new HashMap<>(); queuePriorityProp.put("x-max-priority", 10); // max priority is 10 channel.queueDeclare(QUEUE_NAME, durable, false, false, queuePriorityProp);
After publishing we get:
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());
What is ZeroMQ?
ZeroMQ is an asynchronous messaging library and is developed by iMatrix to be used in distributed applications.It uses sockets for carrying atomic messages across various transport like in process, inter-process, TCP, and multicast.It is written in C++, ZeroMQ is developed by a large community of contributors.
How do we stop the RabbitMQ server on localhost?
sudo -u rabbitmq rabbitmqctl stop
How to restart RabbitMQ service?
We can restart it like any other service:sudo service rabbitmq-server restart
We get a specific control interface as well:
sudo rabbitmqctl "report" sudo rabbitmqctl "reset"