[rabbitmq-discuss] SharedQueue closed error

Alvaro Videla videlalvaro at gmail.com
Wed Apr 2 21:45:19 BST 2014


If you ack the message on the consumer side, then the message will be
removed from the queue.

On Wed, Apr 2, 2014 at 10:39 PM, anate <ambatinr at hotmail.com> wrote:
> 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.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list