本文整理汇总了PHP中AMQPQueue::setArgument方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPQueue::setArgument方法的具体用法?PHP AMQPQueue::setArgument怎么用?PHP AMQPQueue::setArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMQPQueue
的用法示例。
在下文中一共展示了AMQPQueue::setArgument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: declareResponseQueue
/**
* @param \AMQPExchange $exchange
* @return \AMQPQueue
*/
protected function declareResponseQueue(\AMQPExchange $exchange)
{
$queue = new \AMQPQueue($exchange->getChannel());
$queue->setFlags(AMQP_EXCLUSIVE);
if ($this->queueTimeout !== null) {
$queue->setArgument("x-expires", $this->queueTimeout);
}
$queue->declareQueue();
return $queue;
}
示例2: setArgument
/**
* @inheritdoc
*/
public function setArgument(string $key, $value)
{
$this->queue->setArgument($key, $value);
}
示例3: setArgument
/**
* @inheritdoc
*/
public function setArgument($key, $value)
{
return $this->delegate->setArgument($key, $value);
}
示例4: later
/**
* Push a new job onto the queue after a delay.
*
* @param \DateTime|int $delay
* @param string $job
* @param mixed $data
* @param string $queue
*
* @return mixed
*/
public function later($delay, $job, $data = '', $queue = null)
{
$delay = $this->getSeconds($delay);
// declare queue
$destinationQueue = $this->getQueue($queue);
$destinationQueue->declareQueue();
// destination exchange
$destinationExchange = $this->getExchangeForQueue($destinationQueue);
// create the dead letter queue
$deferredQueueName = sprintf('deferred from %s:%s for %ss', $destinationExchange->getName(), $destinationQueue->getName(), number_format($delay));
$deferredQueue = new \AMQPQueue($this->channel);
$deferredQueue->setName($deferredQueueName);
$deferredQueue->setFlags(AMQP_DURABLE);
$deferredQueue->setArgument('x-dead-letter-exchange', $destinationExchange->getName() ?: '');
$deferredQueue->setArgument('x-dead-letter-routing-key', $destinationQueue->getName());
$deferredQueue->setArgument('x-expires', (int) (1.5 * $delay * 1000));
$deferredQueue->declareQueue();
return $destinationExchange->publish($this->createPayload($job, $data), $deferredQueue->getName(), AMQP_NOPARAM, ['delivery_mode' => 2, 'content_type' => 'application/json', 'expiration' => (string) ($delay * 1000)]);
}
示例5: getAMQPExchange
protected function getAMQPExchange()
{
if (is_null(self::$_AMQPExchange)) {
$channel = new AMQPChannel($this->getAMQPConnection());
$exchange = new AMQPExchange($channel);
$exchange->setName($this->getExchangeName());
$exchange->setType($this->getExchangeType());
$exchange->setFlags(AMQP_DURABLE);
$exchange->declare();
$queue = new AMQPQueue($channel);
$queue->setName($this->getQueueName());
$queue->setFlags(AMQP_DURABLE);
$queue->setArgument('x-ha-policy', 'all');
$queue->declare();
$queue->bind($this->getExchangeName(), $this->getRoutingKey());
self::$_AMQPExchange = $exchange;
}
return self::$_AMQPExchange;
}
示例6: setArgument
/**
* @param $key
* @param $value
*
* @return bool
*/
public function setArgument($key, $value)
{
return $this->rawQueue->setArgument($key, $value);
}