I'm currently implementing some logic after getting message from rabbitMQ using basic_get without automatically sending ack for messages being received.
According to the tutorial here (Message acknowledgment section), I can't find the channel reference within the msg itself and send ack like mentioned in above link:
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
That is because in my msg delivery info array there is no such thing channel.
I wonder how could it be that it is missing.
Edit: code snippet of basic get
$msg = $this->channel->basic_get($this->queueName, false);
Here is a var_dump of my message:(Yellow part)
l
According to the AMQP spec get-ok
which is the return value of basic-get
doesn't include the channel, in contrast to what happens with basic-deliver
, which is used when a message arrives for a consumer started with basic-consume
.
So the library behaviour is correct.
See https://github.com/videlalvaro/php-amqplib/blob/master/PhpAmqpLib/Channel/AMQPChannel.php#L1022
vs
https://github.com/videlalvaro/php-amqplib/blob/master/PhpAmqpLib/Channel/AMQPChannel.php#L956