RabbitMq
Presentation
RabbitMQ is an open source messaging broker. It’s often referred to as a message-oriented middleware that implements the Advanced Message Queuing Protocol (AMQP).
AMQP makes it easy to decouple applications.
RabbitMQ provides a common platform for sending and receiving messages, where it guarantee the safety of messages until they are received.
RabbitMQ guarantees data delivery, provides non-blocking operations, and sends push notifications.
RabbitMQ provides a variety of features, including the tuning of application performance, clustering, flexible routing, federation, and so on.
RabbitMQ is one of the most powerful open source message broker software that is widely used in the tech companies such as Mozilla, VMware, Google, AT&T, and so on
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,
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.
Message Queues
Message Queues provide concurrent and asynchronous operations to scale applications
1 | channel.queueDeclare(queueName, true, false, false, null); |
- durable: This specifies whether the queue will survive server restarts. Note that it is required for a queue to be declared as durable if you want persistent messages to survive a server restart.
- exclusive: This specifies whether the queue is restricted to only this connection.
- autoDelete: This specifies whether the queue will be automatically deleted by the RabbitMQ broker as soon as it is not in use.
RabbitMq and EC2
we can easily install our RabbitMQ to the AWS EC2 instance and can save images of the RabbitMQ installed operating system
Virtual hosts
Virtual hosts are administrative containers; they allow to configure many logically independent brokers hosts within one single RabbitMQ instance, to let many different independent applications share the same RabbitMQ server. Each virtual host can be configured with its independent set of permissions, exchanges, and queues and will work in a logically separated environment.
Delayed Message Exchange
1 - Ajouter le plugin (attention sur docker + ubuntu mettre le fichier 777)
1 | sudo docker cp rabbitmq_delayed_message_exchange-0.0.1.ez 88da72966ec8:/usr/lib/rabbitmq/lib/rabbitmq_server-3.6.5/plugins/rabbitmq_delayed_message_exchange-0.0.1.ez |
2 - Declarer un Exchange avec delay
1 |
|
3 - Lors de la reception, renvoyer le message avec un delai
1 |
|