本文整理汇总了PHP中AMQPExchange::setArguments方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPExchange::setArguments方法的具体用法?PHP AMQPExchange::setArguments怎么用?PHP AMQPExchange::setArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMQPExchange
的用法示例。
在下文中一共展示了AMQPExchange::setArguments方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* @param \AMQPExchange|null $exchange
*
* @throws HectorException
*/
public function initialize(\AMQPExchange $exchange = null)
{
if (null == $exchange) {
$exchange = new \AMQPExchange($this->channel->getWrappedChannel());
}
$this->exchange = $exchange;
$this->exchange->setName($this->getName());
$this->exchange->setType($this->context->getType());
$this->exchange->setArguments($this->context->getArguments());
$this->exchange->setFlags((int) $this->context->getFlags());
$this->exchange->declareExchange();
$this->initialized = true;
}
示例2: createExchange
/**
* @inheritdoc
*/
public function createExchange(ChannelInterface $channel, $name, $type = ExchangeInterface::TYPE_DIRECT, $flags = null, array $args = [])
{
$delegate = new \AMQPExchange($channel->getDelegate());
$delegate->setName($name);
$delegate->setType($type);
$delegate->setFlags(Exchange::convertToDelegateFlags($flags));
$delegate->setArguments($args);
return new Exchange($delegate, $channel);
}
示例3: getExchange
/**
* @return \AMQPExchange
* @throws \Exception
*/
protected function getExchange()
{
if (!$this->exchange) {
$this->exchange = new \AMQPExchange($this->getChannel());
$this->exchange->setName($this->exchangeConfig['name']);
$this->exchange->setType($this->exchangeConfig['type']);
$this->exchange->setArguments($this->exchangeConfig['arguments']);
$this->exchange->setFlags($this->exchangeConfig['flags']);
if (!$this->exchange->declareExchange()) {
throw new \Exception('Can not declare exchange ' . $this->exchange->getName());
}
}
return $this->exchange;
}
示例4: exchangeDeclare
protected function exchangeDeclare()
{
if ($this->exchange === null) {
$this->exchange = new AMQPExchange($this->channel);
}
$this->exchange->setName($this->exchangeOptions['name']);
$this->exchange->setType($this->exchangeOptions['type']);
$this->exchange->setFlags($this->getFlagsFromOptions());
$this->exchange->setArguments($this->exchangeOptions['arguments']);
$this->exchange->declareExchange();
foreach ($this->exchangeOptions['binding'] as $bindOpt) {
$this->exchange->bind($bindOpt['name'], $bindOpt['routing-keys']);
}
$this->exchangeDeclared = true;
}
示例5: AMQPConnection
<?php
$cnn = new AMQPConnection();
$ret = $cnn->connect();
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . microtime(true));
$ex->setType(AMQP::TYPE_FANOUT);
$ex->setArguments(array("x-ha-policy" => "all"));
$ex->setFlags(AMQP::PASSIVE | AMQP::DURABLE | AMQP::AUTODELETE | AMQP::INTERNAL);
var_dump($ex);
$ex->setFlags(AMQP::NOPARAM);
echo $ex->getFlags();
$ex->setFlags(2);
echo $ex->getFlags();
$ex->setFlags(0);
echo $ex->getFlags();
$ex->setFlags(2);
echo $ex->getFlags();
// --EXPECT-- 0202
$cnn->disconnect();
示例6: getExchange
/**
* Get exchange
*
* @param string $name The exchange name
*
* @return \AMQPExchange
*/
protected function getExchange($name)
{
if (isset($this->exchanges[$name])) {
return $this->exchanges[$name];
}
$config = $this->getConfig('exchange', $name);
if (null === $config) {
throw new \InvalidArgumentException("Exchange definition '{$name}' doesn't exists.");
}
$connection = $this->getConnection($config['connection']);
$this->exchanges[$name] = $exchange = new \AMQPExchange($connection['channel']);
$exchange->setName(is_callable($config['name']) ? call_user_func($config['name']) : $config['name']);
$exchange->setType(isset($config['type']) ? $config['type'] : 'topic');
$exchange->setFlags(Helper\Options::toFlags($config));
$exchange->declareExchange();
if (isset($config['bindings'])) {
foreach ($config['bindings'] as $binding) {
try {
$this->getExchange($binding['exchange']);
} catch (\InvalidArgumentException $e) {
}
$exchange->bind($binding['exchange'], $binding['routing_key'], isset($binding['arguments']) ? $binding['arguments'] : []);
}
}
if (isset($config['arguments'])) {
$exchange->setArguments($config['arguments']);
}
return $exchange;
}
示例7: setArguments
/**
* @param array $arguments
*
* @return bool
*/
public function setArguments(array $arguments)
{
return $this->rawExchange->setArguments($arguments);
}
示例8: setArguments
/**
* @inheritdoc
*/
public function setArguments(array $arguments)
{
$this->exchange->setArguments($arguments);
}