[rabbitmq-discuss] Script/Connection not getting terminated.

Alvaro Videla videlalvaro at gmail.com
Fri Jun 7 11:20:57 BST 2013


Hi,

I have some questions:

1) Why are you using basic_get instead of basic_consume as shown here:
https://github.com/videlalvaro/php-amqplib/blob/master/demo/amqp_consumer.php#L66This
is much faster.

2) The "tnc" version of the library is not maintained anymore since 2 years
already. There are many bug fixes in this version of the library:
https://github.com/videlalvaro/php-amqplib/

3) As Michael pointed out, do you have any basic_reject calls in your code?

Regards,

Alvaro


On Fri, Jun 7, 2013 at 12:13 PM, tluck <tilak.chauhan at ymail.com> wrote:

> Hi MK,
>
> >> Something in your code rejects messages with unknown delivery tag. This
> >> causes
> the channel to be closed.
>
> Even if a channel is being closed then why script has not been terminated
> ?.
> I'm using `basic_get` method to consume messages.
>
> >> Can you post a fragment of your code that rejects messages and also be
> >> more specific about which PHP library you use?
>
> https://github.com/tnc/php-amqplib -- This is the php library I'm using.
>
> Here is my code sample :
>
> $connection = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
> $channel = $connection->channel();
> $channel->queue_declare($queue, false, true, false, false);
> $channel->exchange_declare('myexchange', 'direct', true, true, false);
> $channel->queue_bind('myqueue', $exchange, $queue);
>
> while ($msg = $channel->basic_get($queue)) {
>     consumerMessage($msg, $connection, $channel);
> }
>
> $channel->close();
> $connection->close();
>
> function consumerMessage($msg, $connection, $channel){
>         $data = json_decode($msg->body, true);
>         IF(thisConsumerIsNotAllowedToConsumeThisMessage){
>             $channel->basic_ack($msg->delivery_info['delivery_tag']);
>             return;
>         }
>
>         DoAllDataProcessing($data);
>         $channel->basic_ack($msg->delivery_info['delivery_tag']);
>         return;
> }
>
>
> Thanks,
> T.luck
>
>
>
>
>
>
> --
> View this message in context:
> http://rabbitmq.1065348.n5.nabble.com/Script-Connection-not-getting-terminated-tp27265p27271.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130607/98353cb0/attachment.htm>


More information about the rabbitmq-discuss mailing list