[rabbitmq-discuss] SharedQueue closed error
anate
ambatinr at hotmail.com
Wed Apr 2 21:39:26 BST 2014
I declared a queue with persistent message using PHP and trying to consume
the message in C#. I received 'SharedQueue closed error' at this line.
channel.BasicAck(ea.DeliveryTag, false);
I am assuming the persistent message shouldn't delete from queue but after
Dequeue() message getting deleted. Could you please let me know if there are
any suggestions.
PHP(Publish)
-----
$channel->queue_declare('hello-queue', false, true, false, false);
$message = "Hello World....";
try{
$msg = new AMQPMessage($message,
array('delivery_mode' => 2) # make message
persistent
);
$channel->basic_publish($msg, '', 'hello-queue');
}
catch (AMQPChannelException $exception)
{
echo "The channel is not open (publishing message on queue).\n";
}
Consume(C#)
---------------
using (IConnection connection =
connectionFactory.CreateConnection())
{
using (var channel = connection.CreateModel())
{
channel.QueueDeclare("hello-queue", true, false,
false, null);
var consumer = new QueueingBasicConsumer(channel);
channel.BasicConsume("hello-queue", true, consumer);
while (true)
{
try
{
var ea =
(BasicDeliverEventArgs)consumer.Queue.Dequeue();
InsertData(message);
channel.BasicAck(ea.DeliveryTag, false);
}
catch
(RabbitMQ.Client.Exceptions.OperationInterruptedException ex)
{
break;
}
}
}
}
--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/SharedQueue-closed-error-tp34504.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
More information about the rabbitmq-discuss
mailing list