RabbitMQ Features & Architecture
Huzaifa Asif
Engineering Lead | Solution Architect | Cloud Engineer | FinTech | SaaS | PaaS | AWS | Azure | GCP
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.
When and why should you use RabbitMQ?
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.
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.
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.
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.
Developpeuse web
7 个月Thank you for sharing
Cloud & DevOps Engineer | Championing SRE Principles | Expert in AWS, Azure, GCP | Delivering Scalable & Reliable Solutions
1 年Great work keep it up ????