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

Marcos Torres marcos.torres at gmail.com
Thu Nov 28 15:19:22 GMT 2013


Thank you sir, works great.

Cheers.


On Thu, Nov 28, 2013 at 12:07 PM, Simon MacMullen <simon at rabbitmq.com>wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131128/ca8a7fff/attachment.html>


More information about the rabbitmq-discuss mailing list