# RabbitMQ Concepts

## What is it?

* RabbitMQ is a message broker, which accepts and forwards messsages.
* Analogus to a postal system i.e., post box, post office and a letter carrier; RabbitMQ act as a delivery mechanism for messages.

## Protocols

* Originally implemented to support only AMPQ _(Advanced Message Queueing Protocol)_, RabbitMQ now supports STOMP _(Streaming Text Oriented Messaging Protocol)_ for streaming, HTTP, MQTT _(MQ Telemetry Transport)_.
* Details on supported protocols can be found [here](https://www.rabbitmq.com/protocols.html).

## RabbitMQ Terminologies

* `Producer`
  * A program that is reponsible for sending/producing a message.
* `Consumer`
  * A program that is responsible to receive/consuming a message.
* `Message Brokers`
  * A program which is reponsible to receive message from publishers _(aka producers)_ and route them to consumers.
* `Exchange`
  * An exchange is responsible for the routing of the messages to the different queues. An exchange accepts messages from the producer application and routes them to message queues with help of header attributes, bindings, and routing keys.
* `Queue`
  * A queue is the buffer that stores messages in the message broker.
* `Bindings`
  * Bindings are rules that exchanges use _(among other things)_ to route messages to queues. A binding is a link between a queue and an exchange.
* `AMQP Entities`
  * Queues, exchanges and bindings are collectively referred to as AMQP entities.

## AMQP Model Diagram

![AMPQ Model Diagram](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-0af8cfd1f1569b637d8c22bca5f45d9df471daa7%2FAMPQ_Model.png?alt=media)

## Applications

* Solves to [Producer-Consumer-Synchronization-Problem](https://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem).
* Distributed Applications can achieve asynchronous communication with the use of MOM _(Message Oriented Middleware)_ such as RabbitMQ.

## Learn More

* [Installation](https://www.rabbitmq.com/download.html)
* [AMQP Model Concepts](https://www.rabbitmq.com/tutorials/amqp-concepts.html)
* [Glossary](https://www.cloudamqp.com/blog/RabbitMQ-and-AMQP-concepts-glossary.html)
* [AMQP 0-9-1 Protocol](https://www.rabbitmq.com/resources/specs/amqp0-9.pdf)
* [Complete Reference Guide](https://www.rabbitmq.com/amqp-0-9-1-reference.html)
* [Difference between RabbitMQ and Kafka](https://aws.amazon.com/compare/the-difference-between-rabbitmq-and-kafka/)
* [Introduction tutorial](https://www.cloudamqp.com/blog/part1-rabbitmq-for-beginners-what-is-rabbitmq.html)
