[rabbitmq-discuss] c# how to get ConfirmSelect errors

Matthias Radestock matthias at rabbitmq.com
Fri Sep 21 10:58:32 BST 2012


On 21/09/12 10:51, Emile Joubert wrote:
> On 20/09/12 14:45, Mark Ward wrote:
>> "setconfirmListener" which has now been renamed to "addConfirmListener".
>>   It appears the .NET version of the rabbitMQ client does not have this
>> method or ability.  It would appear this is what I am looking for but I
>> have not found it in the .NET version.  Is this a lacking feature in the
>> .NET version or am I not looking in the right place?
>
> The method is called IModel.ConfirmSelect(). ("Enable publisher
> acknowledgements.")

i.e. 
https://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v2.8.6/rabbitmq-dotnet-client-2.8.6-client-htmldoc/html/type-RabbitMQ.Client.IModel.html#method-M:RabbitMQ.Client.IModel.ConfirmSelect

which enables confirms.

If you want to receive an event for confirms, use the 
Basic{Ack,Nack}EventHandlers:

https://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v2.8.6/rabbitmq-dotnet-client-2.8.6-client-htmldoc/html/type-RabbitMQ.Client.IModel.html#event-E:RabbitMQ.Client.IModel.BasicAcks

https://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v2.8.6/rabbitmq-dotnet-client-2.8.6-client-htmldoc/html/type-RabbitMQ.Client.IModel.html#event-E:RabbitMQ.Client.IModel.BasicNacks

>> I have the ability to identify the batch of message the fault occurred
>> in but I am seeking if I can identify specifically the messages in the
>> batch.
>
> If you make the batch size 1 then you will be able to identify the
> individual message that was being published when the error occurred.

One can do better than that.

Each message is associated with a sequence number on publish. A client 
can obtain that sequence number with IModel.NextPublishSeqNo - 
https://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v2.8.6/rabbitmq-dotnet-client-2.8.6-client-htmldoc/html/type-RabbitMQ.Client.IModel.html#property-P:RabbitMQ.Client.IModel.NextPublishSeqNo

These very same sequence numbers get referenced in the DeliveryTags of 
the Basic{Ack,Nack}Events, i.e. you get told exactly what messages were 
confirmed / rejected.

This is explained in http://www.rabbitmq.com/confirms.html

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list