当前位置: 首页>>代码示例>>PHP>>正文


PHP AMQPQueue::nack方法代码示例

本文整理汇总了PHP中AMQPQueue::nack方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPQueue::nack方法的具体用法?PHP AMQPQueue::nack怎么用?PHP AMQPQueue::nack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AMQPQueue的用法示例。


在下文中一共展示了AMQPQueue::nack方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nack

 /**
  * Mark a message as explicitly not acknowledged.
  * RabbitMQ supports the nack method that provides all the functionality of
  * basic.reject whilst also allowing for bulk processing of messages.
  * To reject messages in bulk, clients set the multiple flag of the basic.nack method
  * to true. The broker will then reject all unacknowledged, delivered messages up to
  * and including the message specified in the delivery_tag field of the
  * basic.nack method. In this respect, basic.nack complements the bulk acknowledgement
  * semantics of basic.ack.
  *
  * @param integer $flags AMQP_MULTIPLE to nack all previous unacked messages as well.
  *                       AMQP_REQUEUE to requeue the message(s),
  *
  * @return bool
  */
 public function nack($flags = AMQP_REQUEUE)
 {
     if (!$this->consumed) {
         return $this->consumed = $this->queue->nack($this->getDeliveryTag(), $flags);
     }
     return $this->consumed;
 }
开发者ID:gallna,项目名称:amqp-event,代码行数:22,代码来源:ConsumeEvent.php

示例2: nack

 /**
  * @param string $deliveryTag
  * @param int    $flags
  *
  * @return bool
  */
 public function nack($deliveryTag, $flags = Client::NOPARAM)
 {
     try {
         return $this->rawQueue->nack($deliveryTag, $flags);
     } catch (\Exception $e) {
         ClientHelper::throwRightException($e);
     }
 }
开发者ID:csharpru,项目名称:yii2-amqp,代码行数:14,代码来源:Queue.php

示例3: nack

 /**
  * @inheritdoc
  */
 public function nack(int $deliveryTag, int $flags = Constants::AMQP_NOPARAM)
 {
     $this->queue->nack($deliveryTag, $flags);
 }
开发者ID:prolic,项目名称:HumusAmqp,代码行数:7,代码来源:Queue.php

示例4: nack

 /**
  * @inheritdoc
  */
 public function nack($deliveryTag, $flags = AMQP_NOPARAM)
 {
     $this->delegate->nack($deliveryTag, self::convertToDelegateFlags($flags));
 }
开发者ID:treehouselabs,项目名称:queue,代码行数:7,代码来源:Queue.php

示例5: nack

 /**
  * {@inheritDoc}
  */
 public function nack(Message $message, $requeue = false)
 {
     $this->queue->nack($message->getId(), $requeue ? AMQP_REQUEUE : null);
 }
开发者ID:kyar,项目名称:swarrot,代码行数:7,代码来源:PeclPackageMessageProvider.php

示例6: consume

 /**
  * Consumes next message from queue and passes its payload to callback when it arrives
  *
  * @param string $queueName Queue name to consume message from
  * @param callable $callback Callback to pass payload to
  *
  * @throws \AMQPException
  */
 public function consume($queueName, callable $callback)
 {
     try {
         $queue = new \AMQPQueue($this->getChannel());
         $queue->setName($queueName);
         $queue->consume(function (\AMQPEnvelope $envelope, \AMQPQueue $queue) use($callback) {
             switch ($callback($envelope->getBody())) {
                 case self::MESSAGE_ACK:
                     $queue->ack($envelope->getDeliveryTag());
                     break;
                 case self::MESSAGE_NACK:
                     $queue->nack($envelope->getDeliveryTag());
                     break;
                 case self::MESSAGE_REQUEUE:
                     $queue->nack($envelope->getDeliveryTag(), AMQP_REQUEUE);
                     break;
             }
         });
     } catch (\AMQPException $e) {
         $this->channel = null;
         throw $e;
     }
 }
开发者ID:helminster,项目名称:imgloader,代码行数:31,代码来源:AMQPClient.php


注:本文中的AMQPQueue::nack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。