[rabbitmq-discuss] EndOfStreamException SharedQueue closed with .net client

Emile Joubert emile at rabbitmq.com
Fri Mar 25 10:16:48 GMT 2011


Hi Dex,

On 24/03/11 23:13, Dex wrote:
> Hi all,
>
> new to RabbitMQ here :) Version 2.4.0, erlang 5.8.3, win7 x64, .Net 4
>
> Learning the API, I've based the code below on the examples in the
> dotnet client user guide.
>
> When run, the Task thread will dequeue the message fine, but will
> throw when starting to de-queue again:

The problem is the combination of these two lines:

> 			consumerChannel.BasicConsume(consumerQueue, true, consumer);

> 					consumerChannel.BasicAck(e.DeliveryTag, false);

You are consuming from the queue in auto-ack mode and explicitly 
acknowledging the message. This amounts to a duplicate acknowledgement 
which is forbidden. The broker is required by the AMQP specification to 
raise a channel exception in this situation. The exception you see is a 
result of this.

The solution is either to set the auto-ack flag to false when 
registering the consumer or to remove the explicit acknowledgement.

You are closing the channel and connection in the wrong order in the 
task, but the previous error prevents this code from being reached.

In this case you only need a single connection. You can create a 
consumer channel and a producer channel over the same connection. At the 
moment your program won't terminate, because the separate consumer 
connection remains open and the task doesn't know that the main thread 
has terminated.


Regards

Emile






More information about the rabbitmq-discuss mailing list