[rabbitmq-discuss] Messages does not survive a RabbitMQ service restart

Simon MacMullen simon at rabbitmq.com
Thu Nov 28 15:07:14 GMT 2013


On 28/11/13 14:56, Marcos Torres wrote:
> Hi there.
>
> The messages stored in a durable queue doesn't survive a service restart
> (I'm using windows version of Rabbit).
> I'm using message confirmation, but clearly I need to do something else.

You are not marking messages as persistent. I am no .NET expert but I 
think you need something like:

> This is how I'm publishing the messages :
>
>                  using (var channel =
> rabbitConnection.Connection.CreateModel())
>                  {
>                      channel.ConfirmSelect(); //enable confirms on channel

IBasicProperties props = channel.CreateBasicProperties();
props.DeliveryMode = 2; // Persistent

>                      foreach (var message in messages)
>                      {
>                          var serialization =
> _serializer.Serialize(message , Encoding.UTF8);

                            channel.BasicPublish(rabbitAddress.Name,
string.Empty, props, serialization);

>                      }
>                      channel.WaitForConfirms();
>                  }

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list