[rabbitmq-discuss] queue subscription + sending to some exchange

Petar Shomov pshomov at gmail.com
Mon Jun 20 22:41:07 BST 2011

Hi guys,

I have a situation which I do not completely understand and I was
hoping someone more acquainted with AMQP and RabbitMQ might point me
in the right direction.

I have a console app that needs to subscribe to a message queue where
the process of handling a message is rather lengthy. During this
lengthy process I need to send out messages to some exchange which
represent information about the progress of the operation.
The subscription to the queue has to be asynchronous too, since I am
doing something else on the main thread. So I have running in a thread
this code (C#):

                var job = new Thread(() =>
                                             var consumer = new

channel.BasicConsume(queueName, false, consumer);
                                             while (true)
                                                 BasicDeliverEventArgs e = null;
                                                 e =
(BasicDeliverEventArgs) consumer.Queue.Dequeue();


channel.BasicAck(e.DeliveryTag, false);

 Unfortunately when I try to send messages within the message handler
(I am opening a different channel on the same connection, tried even
opening a different connection with no better luck) I am getting these
kind of exceptions, usually when attempting to send the *second*

-		$exception	{"The AMQP operation was interrupted: AMQP close-reason,
initiated by Library, code=504, text=\"Frame received for invalid
channel 2\", classId=0, methodId=0,
cause=RabbitMQ.Client.Impl.ChannelErrorException: Frame received for
invalid channel 2\r\n   at ...

Thoughts, ideas, anything?



More information about the rabbitmq-discuss mailing list