What is the “delivery mode” in AMQP?

后端 未结 2 420
小鲜肉
小鲜肉 2021-02-04 23:15

I understand that 2 options are available:

  • \"Non-persistent\"
  • \"Persistent\"

But what does this actually mean?

\"Non-persistent\"

2条回答
  •  一生所求
    2021-02-05 00:08

    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);
    

提交回复
热议问题