/** * @param $queue * * @return mixed */ public function consume($queue) { $messageBody = false; $message = $this->ch->basic_get($queue); if ($message) { $this->ch->basic_ack($message->delivery_info['delivery_tag']); $messageBody = $message->body; } return $messageBody; }
/** * @Then there should be a message in queue :queue * * @param $queue * @param PyStringNode $string */ public function thereShouldBeAMessageInQueue($queue, PyStringNode $string = null) { $expected = $string ? $string->getRaw() : null; if (null === $expected) { $this->channel->basic_consume($queue); } else { $consumer = function (AMQPMessage $message) use($expected) { $this->channel->basic_ack($message->delivery_info['delivery_tag']); Assert::that($message->body)->equal($expected); }; $this->channel->basic_consume($queue, '', false, false, false, false, $consumer); } $this->channel->wait(null, false, 4); }
public function ack(MessageInterface $message) { if ($this->isConnected()) { $this->channel->basic_ack($message->get('delivery_tag')); $this->logger->info(sprintf("Sent Ack for %n message", $message->get('delivery_tag'))); } }
/** * @param AMQPMessage $message * * @throws \Exception */ public function handle(AMQPMessage $message) { $reply = null; try { $reply = $this->handler->handle($message); $this->channel->basic_ack($message->delivery_info['delivery_tag'], false); } catch (RequestNotSupportedException $exception) { $this->channel->basic_ack($message->delivery_info['delivery_tag'], false); } catch (\Exception $e) { $this->channel->basic_reject($message->delivery_info['delivery_tag'], false); throw $e; } if ($reply !== null) { $this->channel->basic_publish($reply, '', $message->get('reply_to')); } }
function it_releases_job_onto_rabbitmq(AMQPChannel $channel, RabbitMQQueue $queue) { // delete $channel->basic_ack('fooTagId')->shouldBeCalled(); // release with attempts added into body $queue->later(1, 'foo', [0 => "someData", "attempts" => 1], 'default')->shouldBeCalled(); $this->release(1); }
/** * Get the next message from the queue. * @return AMQPMessage * @throws ConnectionError Thrown by self::openConnection if connection cannot be established */ public function getNextMessage() { $this->openConnection(); $message = $this->channel->basic_get($this->config->getQueueName()); // Currently no reason to want to see any message more than once so // ack every message received from the queue. if ($message) { // direct delivery_info array access recommended in PhpAmqpLib documentation $this->channel->basic_ack($message->delivery_info['delivery_tag']); } return $message; }
/** * @param string $deliveryTag * @return mixed */ public function basic_ack($deliveryTag) { return $this->channel->basic_ack($deliveryTag); }
public function acknowledge(AMQPMessage $msg) { $this->channel->basic_ack($msg->delivery_info['delivery_tag']); }
/** * Delete the job from the queue. * * @return void */ public function delete() { parent::delete(); $this->channel->basic_ack($this->amqpMessage->delivery_info['delivery_tag']); }
/** * {@inheritDoc} */ public function ack(Message $message) { $this->channel->basic_ack($message->getId()); }
/** * If the driver supports it, this will be called when a message * have been consumed. * * @param string $queueName * @param mixed $receipt */ public function acknowledgeMessage($queueName, $receipt) { $this->channel->basic_ack($receipt); }
/** * Delete the job from the queue. */ public function delete() { parent::delete(); $this->channel->basic_ack($this->job->get('delivery_tag')); }
/** * Acknowledges the message as received and processed. * * If the message is persistent (delivery_mode 2), we'll need to notify the broker * that it has been processed. The message will persist in the queue until it * has been acknowledged. * * @param int $deliveryId * * @return $this */ public function ack($deliveryId) { $this->channel->basic_ack($deliveryId); return $this; }
public static function acknowledgeMessage(\PhpAmqpLib\Channel\AMQPChannel $channel, \PhpAmqpLib\Message\AMQPMessage $message) { $channel->basic_ack($message->delivery_info['delivery_tag']); }
/** * Acknowledge a job * * @access public * @param Job $job * @return $this */ public function completed(Job $job) { $this->channel->basic_ack($job->getId()); return $this; }