Search code examples
rabbitmqamqprabbitmq-exchange

Question about rabbitmq message persistence mechanism


I am reading Persistence Configuration, and I have some questions.

I know that queues can be either durable or not, and messages are also divided into two categories: persistent or transient.

As the document says: Persistent messages will be written to disk as soon as they reach the queue.

So, here are my questions:

  1. If I send a message and the message was not distributed to any queues, will the message be persistent?
  2. If a queue is non-durable, will the message(persistent or transient, not being consumed) be deleted from disk when the queue is deleted?
  3. If a message is consumed, does rabbitmq delete this messages from physical storage?

Any ideas on how to test these conditions are appreciated.


Solution

  • If I send a message and the message was not distributed to any queues, will the message be persistent?

    No, see mandatory to handle the unroutable messages.

    If a queue is non-durable, will the message(persistent or transient, not being consumed) be deleted from disk when the queue is deleted?

    yes

    If a message is consumed, does rabbitmq delete this messages from physical storage?

    When a message is consumed and the status is unacked the message is not removed.

    when you send the ack or nack the message is removed from the memory/disk.