[rabbitmq-discuss] .NET API - Using PublishConfirms to get Reliability

Michael Klishin mklishin at gopivotal.com
Wed Feb 26 07:15:19 GMT 2014


On 26 Feb 2014, at 09:07, martywaz <marty.wasznicky at neudesic.com> wrote:

> How I'm sending the message is pretty straight forward:
> 
>  
> 
>  
> 
>                        messageProperties.MessageId = System.Guid.NewGuid().ToString()
> 
>                        lock (this.activeMessagesLock)
> 
>                         {
> 
>                             var deliveryTag = 0UL;
> 
>                             deliveryTag = this.model.NextPublishSeqNo;
> 
>  
> 
>                             this.model.BasicPublish(
> 
>                                 this.exchangeName,
> 
>                                 message.Header.Topic,
> 
>                                 this.properties.Durable,
> 
>                                 immediate,
> 
>                                 messageProperties,
> 
>                                 body);
> 
>  
> 
>                             this.activeMessages[deliveryTag] = message;
> 
>                         }
> 

This is not how publisher confirms are mean to be used in the client. It’s fine to manually acquire next delivery
tag and use it. However, you should consider using IModel#WaitForConfirms which will
wait until all outstanding acks arrive or a timeout is reached.

In the case of timeout, you need to republish messages.

MK

Software Engineer, Pivotal/RabbitMQ




More information about the rabbitmq-discuss mailing list