RabbitMQ

RabbitMQ

March 27, 2022
Software
Tech, RabbitMQ

RabbitMQ #

A message broker; accepts and forwards messages Supports multiple protocols, of which AMQP 0-9-1 is one

Queue #

  • Is a buffer that stores messages

  • A mailbox where producer(s) can send messages and consumer(s) can consume them from

  • Creating a queue is idempotent. A message to a non-existent queue is simply dropped by RabbitMQ

  • With configuration, unacknowledged messages by consumers will be redelivered (upone the initial consumer connection closing)

  • By default, queue is not durable. It needs to be declared as such to survived RabbitMQ restart.

Worker Queue #

Or also known as task queue, allows one consumer to receive a message Used to distribute a task amongst many workers aka consumers Be default it round robbins the messages to the workers

Exchange #

  • Producer cannot send messages directly to a Queue (they go via an Exchange)

  • An exchange receives messages and sends them along to queue(s)

  • Multiple types direct, topic, headers and fanout

  • That relationship between exchange and a queue is called a binding.

Direct Exchange #

  • The routing algorithm behind a direct exchange is simple - a message goes to the queues whose binding key exactly matches the routing key of the message. =======

Notes #

Overview #

AMQP Concepts

  • Delivery processing acknowledgements from consumers to RabbitMQ are known as acknowledgements in messaging protocols
  • Broker acknowledgements to publishers are a protocol extension called publisher confirms
  • basic.reject and basic.nack are used for negative acknowledgements. The requeue boolean field controls if broker requeues the message or discard it.
  • The Broker will attempt to place requeued messages in the original position if possible or close to the head of the queue.