setFlags() public method

Set the flags on an exchange.
public setFlags ( integer $flags ) : void
$flags integer A bitmask of flags. This call currently only considers the following flags: AMQP_DURABLE, AMQP_PASSIVE (and AMQP_DURABLE, if librabbitmq version >= 0.5.3)
return void
Example #1
0
 /**
  * @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;
 }
 public function declareExchange($name, $type = AMQP_EX_TYPE_TOPIC, $flags = AMQP_DURABLE)
 {
     $exchange = new \AMQPExchange($this->channel);
     $exchange->setName($name);
     $exchange->setType($type);
     $exchange->setFlags($flags);
     $exchange->declareExchange();
     return $exchange;
 }
Example #3
0
 /**
  * @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);
 }
Example #4
0
 /**
  * Get transport exchange for current channel.
  * @return AMQPExchange
  */
 protected function _getExchange()
 {
     if (!$this->_exchange) {
         $this->_exchange = new \AMQPExchange($this->_getChannel());
         //设置exchange名称
         $this->_exchange->setName($this->_params['exchange']);
         //设置exchange类型
         $this->_exchange->setType(AMQP_EX_TYPE_DIRECT);
         //设置exchange参数
         $this->_exchange->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
     }
     return $this->_exchange;
 }
 /**
  * @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;
 }
 /**
  * {@inheritDoc}
  */
 protected function setUpAmqp()
 {
     $this->conn = new \AMQPConnection(['host' => $_SERVER['AMQP_HOST'], 'port' => $_SERVER['AMQP_PORT'], 'login' => $_SERVER['AMQP_USER'], 'password' => $_SERVER['AMQP_PASS'], 'vhost' => $_SERVER['AMQP_VHOST']]);
     $this->conn->connect();
     $channel = new \AMQPChannel($this->conn);
     $exchange = new \AMQPExchange($channel);
     $exchange->setName('event_band.test.exchange');
     $exchange->setFlags(AMQP_AUTODELETE);
     $exchange->setType(AMQP_EX_TYPE_TOPIC);
     $exchange->declareExchange();
     $queue = new \AMQPQueue($channel);
     $queue->setName('event_band.test.event');
     $queue->declareQueue();
     $queue->bind('event_band.test.exchange', 'event.#');
 }
Example #7
0
 public static function setupConnection(\AMQPConnection $connection, $config)
 {
     $channel = new \AMQPChannel($connection);
     $exchange = new \AMQPExchange($channel);
     $exchange->setName($config['exchange_name']);
     $exchange->setType(AMQP_EX_TYPE_DIRECT);
     $exchange->setFlags(AMQP_DURABLE);
     $exchange->declareExchange();
     $queue = new \AMQPQueue($channel);
     $queue->setName($config['queue_name']);
     $queue->setFlags(AMQP_DURABLE);
     $queue->declareQueue();
     //        $exchange->bind($config['queue_name'], 'gos.websocket.pusher');
     return [$channel, $exchange, $queue];
 }
Example #8
0
 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;
 }
 /**
  * {@inheritDoc}
  */
 public function createExchange()
 {
     // Create AMQP connection
     $amqpConnection = new \AMQPConnection(['host' => $this->host, 'port' => $this->port, 'vhost' => $this->vhost, 'login' => $this->login, 'password' => $this->password]);
     $amqpConnection->connect();
     // Create channel
     $channel = new \AMQPChannel($amqpConnection);
     // Create exchange
     $exchange = new \AMQPExchange($channel);
     $exchange->setName($this->exchangeName);
     $exchange->setType($this->exchangeType);
     $exchange->setFlags(AMQP_DURABLE);
     $exchange->declareExchange();
     return $exchange;
 }
Example #10
0
 /**
  * @param \AMQPEnvelope $envelope
  * @param \AMQPQueue $queue
  * @param string $m
  */
 public function publish($envelope, $queue, $m)
 {
     if ($m instanceof AmqpResp) {
         $m = Json::encode($m->getData());
     } elseif (is_object($m) || is_array($m)) {
         $m = Json::encode($m);
     }
     $chanel = $this->getChanel();
     // Точка доступа
     // Точка обмена
     $exchange = new \AMQPExchange($chanel);
     $exchange->setFlags(AMQP_AUTODELETE | AMQP_DURABLE);
     $attributes = array('correlation_id' => $envelope->getCorrelationId());
     $routingKey = $envelope->getReplyTo();
     if ($exchange->publish($m, $routingKey, AMQP_NOPARAM, $attributes)) {
         $queue->ack($envelope->getDeliveryTag());
     }
 }
Example #11
0
 public static function main()
 {
     self::$pool = new Pool(MAX_CONCURRENCY_JOB, \CALLWorker::class, []);
     $conn_args = (require 'mq.config.php');
     $e_name = 'e_linvo';
     //交换机名
     $q_name = 'q_linvo';
     //队列名
     $k_route = 'key_1';
     //路由key
     //创建连接和channel
     $conn = new AMQPConnection($conn_args);
     if (!$conn->connect()) {
         write_log('mq.hx9999.com 无法连接上');
         return;
     }
     $channel = new AMQPChannel($conn);
     //创建交换机
     $ex = new AMQPExchange($channel);
     $ex->setName($e_name);
     $ex->setType(AMQP_EX_TYPE_DIRECT);
     //direct类型
     $ex->setFlags(AMQP_DURABLE);
     //持久化
     //创建队列
     $q = new AMQPQueue($channel);
     $q->setName($q_name);
     $q->setFlags(AMQP_DURABLE);
     //持久化
     while (True) {
         $q->consume(function ($envelope, $queue) {
             $msg = $envelope->getBody();
             $queue->ack($envelope->getDeliveryTag());
             //手动发送ACK应答
             self::$pool->submit(new Sendsms($msg));
         });
     }
     self::$pool->shutdown();
     $conn->disconnect();
     //睡眠
     sleep(5);
 }
Example #12
0
 public function send($msg)
 {
     $channel = new \AMQPChannel($this->connection);
     $exchange = new \AMQPExchange($channel);
     $exchange->setFlags(AMQP_DURABLE);
     $exchange->setName('exchange2');
     $exchange->setType('direct');
     //$exchange->declare();
     $exchange->declareExchange();
     $queue = new \AMQPQueue($channel);
     $queue->setName('series');
     $queue->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
     //$queue->declare();
     $queue->declareQueue();
     $queue->bind('exchange2', 'series');
     $channel->startTransaction();
     $message = $exchange->publish(json_encode($msg), 'series', AMQP_MANDATORY, array('content_type' => 'application/json', 'delivery_mode' => 2));
     $channel->commitTransaction();
     if (!$message) {
         throw new \SYSTEM\LOG\ERROR("Error: Message '" . $message . "' was not sent to queue.!");
     }
 }
Example #13
0
 /**
  * 入RabbitMQ队列
  * @param [type] $exName    [交换机名]
  * @param [type] $routingKey [路由名]
  * @param [type] $value     [队列的值]
  * @param [type] $dbType     [数据库类型,默认为mysql]
  * 按照此规则生成的默认队列名称为 exName_routeKey_dbType;值为value
  */
 public function set($exName, $routingKey, $value, $dbType = 'mysql')
 {
     //创建交换机,设置交换机名
     $ex = new \AMQPExchange($this->channel);
     $ex->setName($exName);
     $ex->setType(AMQP_EX_TYPE_DIRECT);
     //广播模式
     $ex->setFlags(AMQP_DURABLE);
     //交换器进行持久化,即 RabbitMQ 重启后会自动重建
     // $ex->declareExchange();
     //设置队列名
     $queue = new \AMQPQueue($this->channel);
     $queue->setName($exName . '_' . $routingKey . '_' . $dbType);
     $queue->setFlags(AMQP_DURABLE);
     //队列进行持久化,即 RabbitMQ 重启后会自动重建
     $queue->declareQueue();
     //交换机和路由绑定到队列
     $queue->bind($exName, $routingKey);
     //入队列
     if (is_array($value)) {
         $value = json_encode($value);
     }
     $ex->publish($value, $routingKey, AMQP_NOPARAM, array('delivery_mode' => '2'));
 }
Example #14
0
/**
 * 批量打入v3work_seo_pdrec数据,用于预热本企业推荐产品
 */
function writeRMQ($exchangeName = 'v3www', $router, $data = '')
{
    $cfg = array('host' => '192.168.8.18', 'port' => '5672', 'login' => 'v3work', 'password' => 'gc7232275', 'vhost' => '/');
    if (empty($exchangeName) || empty($data) || empty($cfg)) {
        return false;
    }
    $reTryNum = 3;
    $errMsg = array();
    do {
        try {
            //建立到rmq服务器链接
            $connection = new AMQPConnection($cfg);
            $connection->connect();
            //建立channel对象
            $channel = new AMQPChannel($connection);
            //建立交换机
            $exchange = new AMQPExchange($channel);
            $exchange->setName($exchangeName);
            $exchange->setType(AMQP_EX_TYPE_DIRECT);
            $exchange->setFlags(AMQP_DURABLE);
            $exchange->declare();
            $routingKey = $router;
            //发消息
            $ret = $exchange->publish($data, $routingKey, AMQP_NOPARAM, array('delivery_mode' => '2'));
            //关闭链接
            $connection->disconnect();
            return $ret;
        } catch (Exception $e) {
            $connection->disconnect();
            $errMsg[] = $e->getMessage();
            usleep(5000);
            $reTryNum -= 1;
        }
    } while ($reTryNum);
    return false;
}
Example #15
0
//交换机名
$q_name = 'q_test5';
//队列名称
$r_key = 'key_test1';
//消息
$message = json_encode(array("HelloWorld"));
//创建channel
$channel = new AMQPChannel($conn);
//注:队列跟exchange 都需要基于channel channel基于connection
$ex = new AMQPExchange($channel);
//新建exchange
$ex->setName($e_name);
//创建exchange的名字
$ex->setType(AMQP_EX_TYPE_DIRECT);
//TPYE DIRECT 添加进绑定key的所有的队列,FANOUT 添加进绑定的所有队列 TOPIC 自定义的规则 . 连接多个队列 #为通配符
$ex->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
echo "exchange status:" . $ex->declare();
echo "\n";
//创建队列
$q = new AMQPQueue($channel);
//新建队列
//设置队列的名字 如果不存在则自动添加
$q->setName($q_name);
$q->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
//添加属性 DURABLE持久的 AUTODELEETE没有连接自动删除
echo "queue status:" . $q->declare();
//声明队列
echo "\n";
echo 'queue bind:' . $q->bind($e_name, $r_key);
//将队列绑定到routingKey
echo "\n";
 public function getExchange($name = 'default', $channelName = 'default')
 {
     $key = $channelName . '_' . $name;
     if (!isset($this->exchanges[$key])) {
         $channel = $this->getChannel($channelName);
         if (!isset($this->exchangesSettings[$name])) {
             throw new \LogicException('No settings for exchange ' . $name);
         }
         $settings = $this->exchangesSettings[$name];
         $exchange = new \AMQPExchange($channel);
         $exchange->setName($settings['name']);
         if (strpos($settings['name'], 'amq.') !== 0) {
             $queueFlags = AMQP_NOPARAM;
             if ($settings['durable']) {
                 $queueFlags |= AMQP_DURABLE;
             }
             if ($settings['passive']) {
                 $queueFlags |= AMQP_PASSIVE;
             }
             if ($settings['autoDelete']) {
                 $queueFlags |= AMQP_AUTODELETE;
             }
             $exchange->setType($this->getExchangeType($settings['type']));
             $exchange->setFlags($queueFlags);
             $exchange->declareExchange();
         }
         $this->exchanges[$key] = $exchange;
         //Warning place possible circular links
         if ($settings['to_exchanges'] !== null) {
             foreach ($settings['to_exchanges'] as $binExchangeName => $routingKeys) {
                 $bindExchange = $this->getExchange($binExchangeName, $channelName);
                 foreach ($routingKeys as $routingKey) {
                     $bindExchange->bind($exchange->getName(), $routingKey);
                 }
             }
         }
     }
     return $this->exchanges[$key];
 }
Example #17
0
 /**
  * Declares an exchange on the broker
  *
  * available options:
  *
  * - type: string
  * - passive: boolean
  * - durable: boolean
  * - auto_delete: boolean
  * - internal: boolean
  *
  * @param string $name
  * @param array $options
  *
  * @return CakeAmqpBase
  */
 public function declareExchange($name, $options = array())
 {
     if (!$this->connected()) {
         throw new CakeException(__d('cake_amqp', 'Not connected to broker'));
     }
     if (isset($this->_exchanges[$name])) {
         throw new CakeException(__d('cake_amqp', 'Exchange already exists: %s', $name));
     }
     $defaults = array('type' => 'direct', 'passive' => false, 'durable' => false, 'auto_delete' => true, 'internal' => false);
     $options = array_merge($defaults, $options);
     if (!array_key_exists($options['type'], $this->_exchangeTypes)) {
         throw new CakeException(__d('cake_amqp', 'Exchange type not supported: %s', $options['type']));
     }
     $exchange = new AMQPExchange($this->_channel);
     $exchange->setName($name);
     $exchange->setType($this->_exchangeTypes[$options['type']]);
     $exchange->setFlags($this->__getExchangeFlags($options));
     $exchange->declare();
     $this->_exchanges[$name] = $exchange;
     return $this;
 }
Example #18
0
 /**
  * @param $flags
  *
  * @return bool
  */
 public function setFlags($flags)
 {
     return $this->rawExchange->setFlags($flags);
 }
Example #19
0
 /**
  * Declare new exchange in AMQP broker
  *
  * @param string $name Exchange name
  * @param string $type Exchange type, see AMQP_EX_TYPE_*
  * @param bool $durable Is exchange durable
  *
  * @return bool Success flag
  *
  * @throws ConnectionException
  * @throws \AMQPException
  */
 public function declareExchange($name, $type = AMQP_EX_TYPE_DIRECT, $durable = true)
 {
     try {
         $exchange = new \AMQPExchange($this->getChannel());
         $exchange->setName($name);
         $exchange->setType($type);
         $exchange->setFlags($durable ? AMQP_DURABLE : AMQP_NOPARAM);
         return $exchange->declareExchange();
     } catch (\AMQPConnectionException $e) {
         $this->channel = null;
         throw new ConnectionException($e->getMessage(), $e->getCode(), $e);
     } catch (\AMQPException $e) {
         $this->channel = null;
         throw $e;
     }
 }
Example #20
0
 /**
  * @param \AMQPQueue $queue
  *
  * @return \AMQPExchange
  */
 protected function getExchangeForQueue(\AMQPQueue $queue)
 {
     $amqpExchange = new \AMQPExchange($this->channel);
     $queueOptions = $this->getOptionsForQueue($queue->getName());
     // determine exchange to use
     if (array_key_exists('exchange', $queueOptions) && trim($queueOptions['exchange'])) {
         $amqpExchange->setName((string) $queueOptions['exchange']);
     }
     $options = $this->getOptionsForExchange($amqpExchange->getName());
     $flags = $this->getFlagsFromOptions(['durable', 'passive'], $options);
     $amqpExchange->setFlags($flags);
     $amqpExchange->setType(isset($options['type']) ? $options['type'] : AMQP_EX_TYPE_DIRECT);
     return $amqpExchange;
 }
Example #21
0
 /**
  * Returns exchange
  * Exchange types: direct, topic, headers and fanout.
  * AMQP_EX_TYPE_DIRECT AMQP_EX_TYPE_FANOUT AMQP_EX_TYPE_TOPIC AMQP_EX_TYPE_HEADER
  * AMQP_DURABLE Durable exchanges will survive a broker restart,
  * AMQP_PASSIVE Passive exchanges will not be redeclared, but the broker will throw
  *              an error if the exchange does not exist.
  *
  * @return AMQPExchange
  * @throws AMQPChannelException
  * @throws AMQPExchangeException
  */
 public function exchange($flags = null, $name = null, $type = null)
 {
     $exchange = new \AMQPExchange($this->channel());
     $flags and $exchange->setFlags($flags);
     $type and $exchange->setType($type);
     $name and $exchange->setName($name);
     return $exchange;
 }
Example #22
0
echo 'Publish: ', $iterations, ' iterations took ', $timer, 'sec', PHP_EOL;
$timer = microtime(true);
for ($i = 0; $i < $iterations; $i++) {
    if (!$q->get(AMQP_AUTOACK)) {
        echo 'GET failed', PHP_EOL;
    }
}
$timer = microtime(true) - $timer;
echo '    Get: ', $iterations, ' iterations took ', $timer, 'sec', PHP_EOL;
$q->delete();
$exchange->delete();
echo PHP_EOL;
// ==================================
$exchange = new AMQPExchange($ch);
$exchange->setType(AMQP_EX_TYPE_FANOUT);
$exchange->setFlags(AMQP_AUTODELETE);
$exchange->setName('benchmark_exchange_' . microtime(true));
$exchange->declareExchange();
$q = new AMQPQueue($ch);
$q->setFlags(AMQP_AUTODELETE);
$q->declareQueue();
$q->bind($exchange->getName());
$timer = microtime(true);
for ($i = 0; $i < $iterations; $i++) {
    $exchange->publish($message);
}
$timer = microtime(true) - $timer;
echo 'Publish: ', $iterations, ' iterations took ', $timer, 'sec', PHP_EOL;
$consumer_iterations = $iterations;
$timer = microtime(true);
$q->consume(function () use(&$consumer_iterations) {
Example #23
0
<?php

require 'config.php';
$connection = new AMQPConnection($connect);
$connection->connect();
$channel = new AMQPChannel($connection);
$exchange = new AMQPExchange($channel);
$exchange->setName($exname);
$exchange->setType(AMQP_EX_TYPE_TOPIC);
$exchange->setFlags(AMQP_DURABLE);
$exchange->declare();
$queue = new AMQPQueue($channel);
$queue->setName($qname);
$queue->setFlags(AMQP_DURABLE);
$queue->declare();
$queue->bind($exname, $routekey);
$channel->startTransaction();
$message = json_encode(array('Hello World! 测试消息!', 'TOPIC'));
$exchange->publish($message, $routekey);
$channel->commitTransaction();
$connection->disconnect();
Example #24
0
 /**
  * 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;
 }
Example #25
0
/**
 * 批量打入v3work_seo_pdrec数据,用于预热本企业推荐产品
 */
function writeRMQ($exchangeName = 'v3cb', $routingKey, $data = '')
{
    global $cfg;
    if (empty($exchangeName) || empty($data) || empty($cfg)) {
        return false;
    }
    $reTryNum = 3;
    $errMsg = array();
    do {
        try {
            //建立到rmq服务器链接
            $connection = new AMQPConnection($cfg);
            $connection->connect();
            //建立channel对象
            $channel = new AMQPChannel($connection);
            //建立交换机
            $exchange = new AMQPExchange($channel);
            $exchange->setName($exchangeName);
            $exchange->setType(AMQP_EX_TYPE_DIRECT);
            $exchange->setFlags(AMQP_DURABLE);
            $exchange->declare();
            //发消息
            $ret = $exchange->publish($data, $routingKey, AMQP_NOPARAM, array('delivery_mode' => '2'));
            //关闭链接
            $connection->disconnect();
            return $ret;
        } catch (Exception $e) {
            $connection->disconnect();
            $errMsg[] = $e->getMessage();
            usleep(5000);
            $reTryNum -= 1;
        }
    } while ($reTryNum);
    return false;
}
 /**
  * @param AMQPConnection $AMQPConnection
  * @param $exchangeName
  * @param $exchangeType
  * @return AMQPExchange
  * @throws AMQPConnectionException
  * @throws AMQPExchangeException
  * @throws Exception
  */
 protected function createAMQPExchange($AMQPConnection, $exchangeName, $exchangeType)
 {
     $channel = new AMQPChannel($AMQPConnection);
     $exchange = new AMQPExchange($channel);
     $exchange->setName($exchangeName);
     $exchange->setType($exchangeType);
     $exchange->setFlags(AMQP_DURABLE);
     // Since php_amqp 1.2.0: deprecate AMQPExchange::declare() in favor of AMQPExchange::declareExchange()
     $declareMethodName = method_exists($exchange, 'declareExchange') ? 'declareExchange' : 'declare';
     if (!$exchange->{$declareMethodName}()) {
         throw new Exception('Cannot declare exchange');
     }
     return $exchange;
 }
 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;
 }
<?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();
Example #29
0
 /**
  * @inheritdoc
  */
 public function setFlags(int $flags)
 {
     $this->exchange->setFlags($flags);
 }