本文整理汇总了PHP中AMQPQueue::reject方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPQueue::reject方法的具体用法?PHP AMQPQueue::reject怎么用?PHP AMQPQueue::reject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMQPQueue
的用法示例。
在下文中一共展示了AMQPQueue::reject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reject
/**
* Mark a message as explicitly not acknowledged.
* The AMQP specification defines the basic.reject method that allows clients
* to reject individual, delivered messages, instructing the broker
* to either discard them or requeue them.
*
* @param integer $flags AMQP_REQUEUE to requeue the message(s),
* @return bool
*/
public function reject($flags = AMQP_REQUEUE)
{
if (!$this->consumed) {
return $this->consumed = $this->queue->reject($this->getDeliveryTag(), $flags);
}
return $this->consumed;
}
示例2: process
/**
* @param \AMQPEnvelope $envelope
* @param \AMQPQueue $queue
* @param PushPipe $pushPipe
* @param string $errorQueue
* @param ReceiveCancellationToken $cancellationToken
* @param EndpointControlToken $endpointControlToken
*
* @return bool
*/
public function process(\AMQPEnvelope $envelope, \AMQPQueue $queue, PushPipe $pushPipe, $errorQueue, ReceiveCancellationToken $cancellationToken, EndpointControlToken $endpointControlToken)
{
try {
$messageId = '';
$headers = [];
$pushMessage = false;
try {
$messageId = $this->messageConverter->retrieveMessageId($envelope);
$headers = $this->messageConverter->retrieveHeaders($envelope);
$pushMessage = true;
} catch (\Exception $e) {
$this->routingTopology->sendToQueue($this->brokerModel, $errorQueue, $envelope->getBody(), ['headers' => $envelope->getHeaders()]);
}
if ($pushMessage) {
$pushPipe->push(new PushContext($messageId, $headers, $envelope->getBody() ?: '', $cancellationToken, $endpointControlToken));
}
if ($cancellationToken->isCancellationRequested()) {
$queue->reject($envelope->getDeliveryTag(), AMQP_REQUEUE);
} else {
$queue->ack($envelope->getDeliveryTag());
}
} catch (CriticalErrorException $e) {
// just ... die
throw $e;
} catch (\Exception $e) {
$queue->reject($envelope->getDeliveryTag(), AMQP_REQUEUE);
}
if ($endpointControlToken->isShutdownRequested()) {
return false;
}
return true;
}
示例3: reject
/**
* @param string $deliveryTag
* @param int $flags
*
* @return bool
*/
public function reject($deliveryTag, $flags = Client::NOPARAM)
{
try {
return $this->rawQueue->reject($deliveryTag, $flags);
} catch (\Exception $e) {
ClientHelper::throwRightException($e);
}
}
示例4: reject
/**
* @inheritdoc
*/
public function reject(int $deliveryTag, int $flags = Constants::AMQP_NOPARAM)
{
$this->queue->reject($deliveryTag, $flags);
}
示例5: reject
/**
* @inheritdoc
*/
public function reject($deliveryTag, $flags = AMQP_NOPARAM)
{
$this->delegate->reject($deliveryTag, self::convertToDelegateFlags($flags));
}
示例6: basic_reject
/**
* @param string $deliveryTag
* @param boolean $requeue
* @return mixed
*/
public function basic_reject($deliveryTag, $requeue = true)
{
$this->queue->reject($deliveryTag, $requeue ? AMQP_REQUEUE : AMQP_NOPARAM);
}