本文整理汇总了PHP中PhpAmqpLib\Channel\AMQPChannel::basic_ack方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPChannel::basic_ack方法的具体用法?PHP AMQPChannel::basic_ack怎么用?PHP AMQPChannel::basic_ack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpAmqpLib\Channel\AMQPChannel
的用法示例。
在下文中一共展示了AMQPChannel::basic_ack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: consume
/**
* @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;
}
示例2: thereShouldBeAMessageInQueue
/**
* @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);
}
示例3: ack
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')));
}
}
示例4: handle
/**
* @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'));
}
}
示例5:
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);
}
示例6: getNextMessage
/**
* 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;
}
示例7: basic_ack
/**
* @param string $deliveryTag
* @return mixed
*/
public function basic_ack($deliveryTag)
{
return $this->channel->basic_ack($deliveryTag);
}
示例8: acknowledge
public function acknowledge(AMQPMessage $msg)
{
$this->channel->basic_ack($msg->delivery_info['delivery_tag']);
}
示例9: delete
/**
* Delete the job from the queue.
*
* @return void
*/
public function delete()
{
parent::delete();
$this->channel->basic_ack($this->amqpMessage->delivery_info['delivery_tag']);
}
示例10: ack
/**
* {@inheritDoc}
*/
public function ack(Message $message)
{
$this->channel->basic_ack($message->getId());
}
示例11: acknowledgeMessage
/**
* 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);
}
示例12: delete
/**
* Delete the job from the queue.
*/
public function delete()
{
parent::delete();
$this->channel->basic_ack($this->job->get('delivery_tag'));
}
示例13: ack
/**
* 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;
}
示例14: acknowledgeMessage
public static function acknowledgeMessage(\PhpAmqpLib\Channel\AMQPChannel $channel, \PhpAmqpLib\Message\AMQPMessage $message)
{
$channel->basic_ack($message->delivery_info['delivery_tag']);
}
示例15: completed
/**
* Acknowledge a job
*
* @access public
* @param Job $job
* @return $this
*/
public function completed(Job $job)
{
$this->channel->basic_ack($job->getId());
return $this;
}