A Broker With Routing Logic
AMQP is a messaging protocol where a broker does more than relay. It separates the place a message is sent from the place it is stored, giving flexible routing.
Exchanges And Queues
A publisher sends to an exchange, not directly to a queue. The exchange decides which queues receive a copy based on rules.
- A direct exchange routes by an exact routing key match.
- A topic exchange routes by pattern matching on the key.
- A fanout exchange copies to every bound queue.
A binding links an exchange to a queue and carries the matching rule. Consumers then read from queues.
Acknowledgement And Durability
AMQP gives strong delivery control.
- A consumer acknowledges a message, and unacknowledged messages are redelivered.
- Queues and messages can be durable so they survive a broker restart.
- A publisher confirm lets the sender know the broker accepted a message.
Flow And Fairness
A prefetch limit caps how many unacknowledged messages a consumer holds, spreading load across workers. Dead letter handling routes messages that expire or are rejected to a separate queue for later inspection.
Key idea
AMQP routes messages through exchanges into queues by binding rules, and adds acknowledgements, durability, confirms, and prefetch limits for reliable and fair delivery.