RabbitMQ Features & Architecture

RabbitMQ Features & Architecture


No alt text provided for this image

What is RabbitMQ?

RabbitMQ is a message-oriented middleware that functions as a message broker or queue manager. It provides a platform for applications to connect and exchange messages in the form of queues. By doing so, RabbitMQ enables applications to communicate and process data asynchronously.

  • A message is a form of information that can be shared in a variety of ways. It may contain details about a process or job, or it could be a simple text message. When a message is sent, it is stored in a queue-manager software until a receiving application connects and retrieves it. The application then takes care of the message, doing whatever it was designed to do.
  • A message broker serves as an intermediary between different services, such as a web application. They can be used to lighten the load on web application servers and speed up response times by offloading tasks that may take a significant amount of time or resources to a separate entity.

No alt text provided for this image

When and why should you use RabbitMQ?

  • Message queueing offers web servers a way to quickly respond to requests, as it eliminates the need to perform lengthy procedures in the moment. Additionally, it is beneficial when broadcasting a message to multiple consumers, or when attempting to balance the workload between workers.
  • The consumer retrieves a message from the queue and begins to process the PDF. Meanwhile, the producer adds new messages to the queue. Although the two applications may be on separate servers, or even written in different programming languages, they are only connected via the messages they send to each other. This low coupling ensures that the producer and consumer do not depend on each other and can easily communicate.

RabbitMQ Architecture

The message queue system architecture is composed of client applications, known as producers, that generate and deliver messages to the broker (the message queue). Consumers can then connect to the queue and subscribe to the messages for processing. Applications may either produce, consume, or both produce and consume messages. Messages sent to the queue are retained until they are retrieved by the consumer.

No alt text provided for this image

RabbitMQ EXCHANGES

Producers do not directly publish messages to a queue, instead they are sent to an exchange. Exchanges are used to route messages to different queues through bindings and routing keys. Bindings are what connects a queue to an exchange.

No alt text provided for this image

Types of Exchanges

Direct:?Messages published to an exchange with a specific routing key are routed to the queues whose binding key exactly matches that routing key. For instance, if a queue is linked to an exchange with a binding key of “pdfprocess”, any message sent to the exchange with the same routing key of “pdfprocess” will be sent to that queue.

Fanout:?A fanout exchange sends messages to all of its bound queues. It is an efficient way to distribute messages to multiple locations quickly.

Topic:?The topic exchange matches the routing key with the routing pattern specified in the binding using a wildcard.

Headers:?Message headers are used for routing in message header exchange. This means that attributes in the message header are used to determine the route of a message.

No alt text provided for this image

RabbitMQ Core Concepts

1-?Producer?is a type of application that is responsible for sending out messages.


2-?Consumer?is an application that receives messages. It is responsible for processing and responding to the messages it receives.

3-?Queue?is an ordered data structure that is used to store messages. It is implemented as a buffer that holds messages until they are processed.

4-?Message?sent from a producer to a consumer via RabbitMQ is a form of communication wherein the producer sends information to the consumer. This is done via RabbitMQ, which is a messaging platform that enables communications between the two parties.

5-?TCP connection?can be established between your application and the RabbitMQ broker. This connection allows for data to be exchanged between the two systems.

6-?Channel?is a virtual pathway within a connection. This pathway is used when publishing or retrieving messages from a queue. All of the communication is done over the channel.

7-?Exchanges?are responsible for accepting messages from producers and delivering them to queues based on exchange types. Queues must be bound to an exchange in order to receive messages.

8-?Binding?is a connection established between a queue and an exchange. It creates a pathway for messages to be routed from the exchange to the queue.

9-?Routing key?is a tool used by an exchange to decide which queue a message should be sent to. It functions like an address, allowing the exchange to direct the message accordingly.

10-?AMQP?is an advanced protocol that is used by RabbitMQ to facilitate messaging between applications. It is a reliable and secure way to communicate between applications.

11-?Access:?RabbitMQ can be accessed by providing a username and password. This allows users to be assigned specific rights, such as read, write, and configure permissions, as well as privileges for certain virtual hosts.

12- Using?Virtual hosts, RabbitMQ offers a way to divide applications using the same instance. Different users can be given different access privileges to distinct vhosts, where individual queues and exchanges can be generated and confined to one vhost.

Manzara GBANE

Developpeuse web

7 个月

Thank you for sharing

Muhammad Talha Pasha

Cloud & DevOps Engineer | Championing SRE Principles | Expert in AWS, Azure, GCP | Delivering Scalable & Reliable Solutions

1 年

Great work keep it up ????

要查看或添加评论,请登录

Huzaifa Asif的更多文章

社区洞察

其他会员也浏览了