8

I have installed RabbitMQ on windows server 2012 64 Bit.

I Tested Publishing And Consuming Parts with Huge Data Everything is fine, the only problem i am facing is the messages in a queue are getting lost after RabbitMQServer restart.

I am using VB.Net SDK of RabbitMQ.

I am setting "Durable" property of Queue Declare to true, and DeliveryMode BasicQueueProperties to "2" to make the Messages persistent. But still the messages are getting lost after my server restart.

How can I overcome this?

braX
  • 11,506
  • 5
  • 20
  • 33
madhu
  • 81
  • 1
  • 2
  • Are you declaring your queue `channel.QueueDeclare("queue", true, false, false, null);` ie. with exclusive and auto delete set to false? If yes, try to check your queue property using the web console or the [rabbitmqctl](https://www.rabbitmq.com/man/rabbitmqctl.1.man.html) – Nicolas Labrot Apr 08 '15 at 18:47

1 Answers1

11

https://www.rabbitmq.com/tutorials/tutorial-two-dotnet.html

In this page Message durability on RabbitMQ, it's explained good:

At this point we're sure that the task_queue queue won't be lost even if RabbitMQ restarts. Now we need to mark our messages as persistent - by setting IBasicProperties.Persistent to true.

var properties = channel.CreateBasicProperties();
properties.Persistent = true;
Note on message persistence

Marking messages as persistent doesn't fully guarantee that a message won't be lost. Although it tells RabbitMQ to save the message to disk, there is still a short time window when RabbitMQ has accepted a message and hasn't saved it yet. Also, RabbitMQ doesn't do fsync(2) for every message -- it may be just saved to cache and not really written to the disk. The persistence guarantees aren't strong, but it's more than enough for our simple task queue. If you need a stronger guarantee then you can use publisher confirms.

Pang
  • 9,564
  • 146
  • 81
  • 122
efaruk
  • 882
  • 9
  • 25