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


PHP AMQPQueue::setName方法代码示例

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


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

示例1: getSrvQueue

 /**
  * @return \AMQPQueue
  */
 public function getSrvQueue()
 {
     if ($this->srvQueue === null) {
         $chanel = $this->getChanel();
         /* create a queue object */
         $this->srvQueue = new \AMQPQueue($chanel);
         $this->srvQueue->setName($this->queueName);
         $this->srvQueue->setFlags(AMQP_DURABLE);
         $this->srvQueue->declareQueue();
     }
     return $this->srvQueue;
 }
开发者ID:andriell,项目名称:yii2-amqp,代码行数:15,代码来源:AmqpConsumer.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln(sprintf('Move messages from queue "%s" (vhost: "%s") to exchange "%s" with routingKey "%s" (vhost: "%s")', $input->getArgument('from_queue'), $input->getArgument('from_vhost'), $input->getArgument('to_exchange'), $input->getArgument('to_routing_key'), $input->getArgument('to_vhost')));
     $fromChannel = $this->getChannel($input->getArgument('from_connection'), $input->getArgument('from_vhost'));
     if (null === ($toConnectionName = $input->getOption('to_connection'))) {
         $toChannel = $this->getChannel($input->getArgument('from_connection'), $input->getArgument('to_vhost'));
     } else {
         $toChannel = $this->getChannel($input->getOption('to_connection'), $input->getArgument('to_vhost'));
     }
     $queue = new \AMQPQueue($fromChannel);
     $queue->setName($input->getArgument('from_queue'));
     $exchange = new \AMQPExchange($toChannel);
     $exchange->setName($input->getArgument('to_exchange'));
     $messageProvider = new PeclPackageMessageProvider($queue);
     $messagePublisher = new PeclPackageMessagePublisher($exchange);
     $options = array();
     $stack = new \Swarrot\Processor\Stack\Builder();
     if (0 !== ($max = (int) $input->getOption('max-messages'))) {
         $stack->push('Swarrot\\Processor\\MaxMessages\\MaxMessagesProcessor');
         $options['max_messages'] = $max;
     }
     $stack->push('Swarrot\\Processor\\Insomniac\\InsomniacProcessor');
     $stack->push('Swarrot\\Processor\\Ack\\AckProcessor', $messageProvider);
     $processor = $stack->resolve(new MoveProcessor($messagePublisher, $input->getArgument('to_routing_key')));
     $consumer = new Consumer($messageProvider, $processor);
     $consumer->consume($options);
 }
开发者ID:stof,项目名称:rabbit-mq-admin-toolkit,代码行数:27,代码来源:MessageMoveCommand.php

示例3: _initPublisher

 private function _initPublisher()
 {
     if (!$this->open()) {
         return false;
     }
     if ($this->_exchange) {
         return true;
     }
     $channel = new AMQPChannel($this->_conn);
     //创建exchange
     $this->_exchange = new AMQPExchange($channel);
     $this->_exchange->setName($this->_connInfo['exchangeName']);
     $this->_exchange->setType(AMQP_EX_TYPE_DIRECT);
     $this->_exchange->setFlags(AMQP_DURABLE);
     if (!$this->_exchange->declareExchange()) {
         $this->close();
         return false;
     }
     //创建队列,生产者和消费者都要创建队列
     $queue = new AMQPQueue($channel);
     $queue->setName($this->_connInfo['queueName']);
     $queue->setFlags(AMQP_DURABLE);
     $queue->declareQueue();
     $queue->bind($this->_connInfo['exchangeName'], $this->_connInfo['routingKey']);
     return true;
 }
开发者ID:ehovel,项目名称:message-queue,代码行数:26,代码来源:RabbitQueue.php

示例4: declareQueue

 public function declareQueue($name, $flags = AMQP_DURABLE)
 {
     $queue = new \AMQPQueue($this->channel);
     $queue->setName($name);
     $queue->setFlags($flags);
     $queue->declareQueue();
     return $queue;
 }
开发者ID:Jmoati,项目名称:SwarrotBootstrapBundle,代码行数:8,代码来源:PeclAmqpPackageProvider.php

示例5: getAMQPQueue

 protected function getAMQPQueue($name)
 {
     $connection = new \AMQPConnection(array('vhost' => 'swarrot'));
     $connection->connect();
     $channel = new \AMQPChannel($connection);
     $queue = new \AMQPQueue($channel);
     $queue->setName($name);
     return $queue;
 }
开发者ID:Niktux,项目名称:swarrot,代码行数:9,代码来源:PeclPackageMessageProviderTest.php

示例6: register

 /**
  * {@inheritDoc}
  */
 public function register(Container $c)
 {
     $c['amqp.connections.initializer'] = function ($c) {
         $config = $c['amqp.options'];
         $connections = array();
         if (isset($config['connections'])) {
             foreach ($config['connections'] as $name => $options) {
                 $connections[$name] = new \AMQPConnection($options);
             }
             return $connections;
         }
         if (isset($config['connection'])) {
             return array('default' => new \AMQPConnection($config['connection']));
         }
         throw new \LogicException('No connection defined');
     };
     $c['queue.factory'] = function ($c) {
         $connections = $c['amqp.connections.initializer'];
         return function ($queueName, $connectionName = null) use($connections) {
             $names = array_keys($connections);
             if (null === $connectionName) {
                 $connectionName = reset($names);
             }
             if (!array_key_exists($connectionName, $connections)) {
                 throw new \InvalidArgumentException(sprintf('Unknown connection "%s". Available: [%s]', $connectionName, implode(', ', $names)));
             }
             $connection = $connections[$connectionName];
             if (!$connection->isConnected()) {
                 $connection->connect();
             }
             $channel = new \AMQPChannel($connection);
             $queue = new \AMQPQueue($channel);
             $queue->setName($queueName);
             return $queue;
         };
     };
     $c['exchange.factory'] = function ($c) {
         $connections = $c['amqp.connections.initializer'];
         return function ($exchangeName, $connectionName = null) use($connections) {
             $names = array_keys($connections);
             if (null === $connectionName) {
                 $connectionName = reset($names);
             }
             if (!array_key_exists($connectionName, $connections)) {
                 throw new \InvalidArgumentException(sprintf('Unknown connection "%s". Available: [%s]', $connectionName, implode(', ', $names)));
             }
             $connection = $connections[$connectionName];
             if (!$connection->isConnected()) {
                 $connection->connect();
             }
             $channel = new \AMQPChannel($connection);
             $exchange = new \AMQPExchange($channel);
             $exchange->setName($exchangeName);
             return $exchange;
         };
     };
 }
开发者ID:odolbeau,项目名称:amqp-service-provider,代码行数:60,代码来源:AMQPServiceProvider.php

示例7: getQueue

 /**
  * @param string $name
  *
  * @return \AMQPQueue
  */
 protected function getQueue($name)
 {
     if (!isset($this->queues[$name])) {
         $queue = new \AMQPQueue($this->getChannel());
         $queue->setName($name);
         $this->queues[$name] = $queue;
     }
     return $this->queues[$name];
 }
开发者ID:event-band,项目名称:band-transport-amqp-pecl,代码行数:14,代码来源:PeclAmqpDriver.php

示例8: get

 public function get($queueName, $timeout = null)
 {
     if (null === $this->queue) {
         $queue = new \AMQPQueue($this->channel);
         $queue->setName($queueName);
         $queue->declare();
     }
     return unserialize($queue->consume());
 }
开发者ID:rcambien,项目名称:riverline-worker-bundle,代码行数:9,代码来源:AMQP.php

示例9: createQueue

 /**
  * @inheritdoc
  */
 public function createQueue(ChannelInterface $channel, $name = null, $flags = null, array $args = [])
 {
     $delegate = new \AMQPQueue($channel->getDelegate());
     $delegate->setFlags(Queue::convertToDelegateFlags($flags));
     $delegate->setArguments($args);
     if (null !== $name) {
         $delegate->setName($name);
     }
     return new Queue($delegate, $channel);
 }
开发者ID:treehouselabs,项目名称:queue,代码行数:13,代码来源:AmqpFactory.php

示例10: init

 /**
  * AMQP queue initialization
  * @param string $name Queue name
  * @param string $mode Access mode: r is for reading and w is for writing
  * @return \AMQPQueue
  */
 public function init($name, $mode = 'w')
 {
     $queue = new \AMQPQueue($this->channel);
     $queue->setName($name);
     $queue->declare();
     if ($mode == 'r') {
         $queue->bind('Celium', $name);
     }
     return $queue;
 }
开发者ID:zarincheg,项目名称:celium,代码行数:16,代码来源:Rabbit.php

示例11: getQueue

 /**
  * @return \AMQPQueue
  */
 protected function getQueue()
 {
     if (!$this->queue) {
         $this->queue = new \AMQPQueue($this->getChannel());
         $this->queue->setName($this->queueConfig['name']);
         $this->queue->setFlags($this->queueConfig['flags']);
         $this->queue->declareQueue();
     }
     return $this->queue;
 }
开发者ID:paulchyrilov,项目名称:zf2-rabbitmq-eventbus-module,代码行数:13,代码来源:EventBusAdapter.php

示例12: take

 public function take()
 {
     $q = new \AMQPQueue($this->amqpChannel);
     $q->setName($this->name);
     $msg = $q->get();
     if (empty($msg)) {
         return false;
     } else {
         return new MessageTakeControl($q, $msg);
     }
 }
开发者ID:xezzus,项目名称:amqp-im,代码行数:11,代码来源:Message.php

示例13: getQueue

 /**
  * getQueue.
  *
  * @param string $name
  * @param string $connection
  *
  * @return \AMQPQueue
  */
 public function getQueue($name, $connection)
 {
     if (!isset($this->queues[$connection][$name])) {
         if (!isset($this->queues[$connection])) {
             $this->queues[$connection] = array();
         }
         $queue = new \AMQPQueue($this->getChannel($connection));
         $queue->setName($name);
         $this->queues[$connection][$name] = $queue;
     }
     return $this->queues[$connection][$name];
 }
开发者ID:virhi,项目名称:SwarrotBundle,代码行数:20,代码来源:PeclFactory.php

示例14: it_should_initialize

 public function it_should_initialize(\AMQPQueue $queue, Exchange $exchange, Context $context)
 {
     $exchange->getName()->willReturn('exchange');
     $context->getFlags()->willReturn(1234);
     $context->getArguments()->willReturn(['foo' => 'bar']);
     $queue->setName('queue')->shouldBeCalled();
     $queue->bind('exchange')->shouldBeCalled();
     $queue->setFlags(1234)->shouldBeCalled();
     $queue->setArguments(['foo' => 'bar'])->shouldBeCalled();
     $queue->declareQueue()->shouldBeCalled();
     $this->initialize($queue);
     $this->isInitialized()->shouldReturn(true);
 }
开发者ID:Evaneos,项目名称:Hector,代码行数:13,代码来源:QueueSpec.php

示例15: subscribe

 public function subscribe($topic, $queueName, $process_callback)
 {
     $channel = new AMQPChannel($this->amqpConnection);
     $channel->setPrefetchCount(0);
     $queue = new AMQPQueue($channel);
     $queue->setName($queueName);
     $queue->setFlags(AMQP_DURABLE);
     $queue->declareQueue();
     $queue->bind('topic', $topic);
     $queue->consume($process_callback);
     if (!$this->amqpConnection->disconnect()) {
         throw new Exception("Could not disconnect !");
     }
 }
开发者ID:rgwybb,项目名称:tars,代码行数:14,代码来源:Amqp.php


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