[rabbitmq-discuss] Connection Closing when used by more that one exchange

Emile Joubert emile at rabbitmq.com
Fri Jun 10 13:14:18 BST 2011

Hi Marcus,

On 07/06/11 18:12, Marcus Vinitius Baffa wrote:

> As you can see the sendReply opens another connection and channel to
> send the reply back to the consumer. I know I can use the RPC pattern
> but I need to send a message back like this.

You code does execute, but the peak performance achievable will be
limited, because you are establishing a new channel for each reply.

> When I try to define one connection that would be used by the
> receiveMessageAmqp and the sendReply it stops working.

This works fine for me when I modify your example to use the same
connection for both receiver and sender.

> What happens is that the first message received everything works ok, the
> message is received and the reply is sent. When another message is sent
> by the producer the consumer receives the message and the line
> channel.BasicAck( basicDeliveryEventArgs.DeliveryTag, false ); is
> executed an exception is thrown:

Are you perhaps acknowledging the same message twice? Does the broker
logfile contain anything useful around the time this happens?

> base {RabbitMQ.Client.Exceptions.OperationInterruptedException} = {"The
> AMQP operation was interrupted: AMQP close-reason, initiated by
> Application, code=200, text=\"Connection close forced\", classId=0,
> methodId=0, cause="}

"initiated by Application" normally means a shutdown initiated by the
application using the library, but I'm not sure I believe it in this
case. Your code traps and ignores exceptions in many places - are you
sure the real reason is masked in that way?


More information about the rabbitmq-discuss mailing list