Is a cross platform messaging queue.
You can think of it as Pub/Sub on a system level as opposed to appication level.
- Publisher: client that sends messages to a broker.
- Message Broker: Recieves messages from Publisher (client) & routes them to an exchange
- Exchange: Recieves messages from broker and routes them to a queue via bindings
- Queue: collection of messages used to communicate between systems
- Consumer: Subscribes to the queue and pulls messages
Exchanges - The middleman
AMQP entities that recieve messages sent to them via a message broker.
The purpose of an exchange is to act as a middleman between the Publisher and a queue. They route these messages to queues based on bindings. These bindings have different types depending on which type of exchange is used.
- Direct Exchange: Is where the routing key matches the queue key. Ideal if you want to publish messages onto just one queue
- Fanout Exchange: Routes messages to all queues bound to it. Think of this as indiscriminate broadcast.
- Topic Exchange: Routes messages to queues who with a blob style matching on route keys. So in esscence, routing messages to groups of queues.You can think of this as wildcard matching.
- Header Exchange: One or more of the headers are used to compose a key which matches the queue.
Exchanges have a common interface that they adhere to. This consists of:
- Name: The name of the exchange
- Durability: Persisting the message to disk?
- Auto-delete: Delete the message when not needed
- Arguments: Message broker dependent
Message brokers contain a default exchange which is blank routing key of
" " means go to all queues. Every queue that is created is automatically bound to an exchange of the same name by the message broker
Messages are placed on a queue in a fifo method. Messages can be removed from a queue either when the message is sent to the consumer, or once a consumer sends and acknoledgement message back to the broker.