Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the "delivery mode" in AMQP?

Tags:

amqp

I understand that 2 options are available:

  • "Non-persistent"
  • "Persistent"

But what does this actually mean?

"Non-persistent" as in : the AMQP fabric will try to deliver the message if there are no consumers, the message will be dropped?

"Persistent" as in : AMQP will retry the message until a consumer accepts it??

like image 863
jldupont Avatar asked Feb 26 '10 18:02

jldupont


People also ask

What is delivery mode in RabbitMQ?

When a consumer (subscription) is registered, messages will be delivered (pushed) by RabbitMQ using the basic. deliver method. The method carries a delivery tag, which uniquely identifies the delivery on a channel. Delivery tags are therefore scoped per channel.

How will you categorize the different message modes in AMQP?

AMQP allows for various guaranteed messaging modes specifying a message be sent: At-most-once(sent one time with the possibility of being missed). At-least-once (guaranteeing delivery with the possibility of duplicated messages). Exactly-once (guaranteeing a one-time only delivery).

How many types of message delivery guarantee services are provided by AMQP?

For a queue to receive messages, it must be bound to at least one exchange. AMQP 0.9. 1 brokers should provide four exchange types - direct exchange, fanout exchange, topic exchange, and header exchange.


2 Answers

Messages marked as 'persistent' that are delivered to 'durable' queues will be logged to disk. Durable queues are recovered in the event of a crash, along with any persistent messages they stored prior to the crash.

like image 181
alexis Avatar answered Sep 23 '22 14:09

alexis


delivery_mode in AMQP determines if message will be stored on disk after broker restarts. You can mark messages as persistent - by seting delivery_mode property = 2 when you publish message for instance in PHP (PECL AMQP extension):

$exchange->publish($text, $routingKey, null, array('delivery_mode' => 2)); 

You would also need to declare queue as durable (or it will be dropped after broker stops)

$queue->setFlags(AMQP_DURABLE); 
like image 26
Grzegorz Motyl Avatar answered Sep 24 '22 14:09

Grzegorz Motyl