[rabbitmq-discuss] Can a Publish be acknowledged.

Matthias Radestock matthias at rabbitmq.com
Tue Oct 4 08:31:34 BST 2011


Tim,

On 04/10/11 08:10, Tim Yen wrote:
> After enabling confirm select how can I know which message is being confirmed or
> nacked by the various callbacks assuming that its all asynchronous?
>
> The BasicAckEvent and Nack event handlers have the DeliveryTag but how do i get
> this number on BasicPublish?

Publishes are numbered sequentially. The BasicAck/Nack delivery tag 
contains that sequence number.

In the RabbitMQ clients the channel ("IModel" in the .net client 
terminology) keeps track of the sequence number. See 
http://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v2.6.1/rabbitmq-dotnet-client-2.6.1-client-htmldoc/html/type-RabbitMQ.Client.IModel.html#property-P:RabbitMQ.Client.IModel.NextPublishSeqNo

> Also the BasicReturnEventArgs has no DeliveryTag.  Can I just ignore the
> BasicReturn and rely on only the Ack and Nack event handlers?

You cannot. When a broker confirms a message it is telling the client 
that it has taken responsibility for it. One way the broker can 
discharge its responsibility is by returning the message. Hence messages 
returned with basic.return are *ack*ed, not nack'ed.

> As I dont need the performance WaitForConfirms seems to be the go but it doesn't
> appear to be implemented in the .net code.  It seems to
> be Java only.  Maybe its hidden somewhere anybody know?

It's not exactly hidden:

http://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v2.6.1/rabbitmq-dotnet-client-2.6.1-client-htmldoc/html/type-RabbitMQ.Client.IModel.html#method-M:RabbitMQ.Client.IModel.WaitForConfirms


Matthias.


More information about the rabbitmq-discuss mailing list