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


PHP AMQPQueue::declareQueue方法代码示例

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


在下文中一共展示了AMQPQueue::declareQueue方法的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: _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

示例3: declareQueue

 /**
  * @return int
  */
 public function declareQueue()
 {
     try {
         return $this->rawQueue->declareQueue();
     } catch (\Exception $e) {
         ClientHelper::throwRightException($e);
     }
 }
开发者ID:csharpru,项目名称:yii2-amqp,代码行数:11,代码来源:Queue.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: 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;
 }
开发者ID:boekkooi,项目名称:tactician-amqp,代码行数:14,代码来源:CommandPublisher.php

示例6: 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

示例7: declareQueue

 /**
  * @inheritdoc
  */
 public function declareQueue() : int
 {
     try {
         return $this->queue->declareQueue();
     } catch (\AMQPQueueException $e) {
         throw QueueException::fromAmqpExtension($e);
     } catch (\AMQPChannelException $e) {
         throw ChannelException::fromAmqpExtension($e);
     }
 }
开发者ID:prolic,项目名称:HumusAmqp,代码行数:13,代码来源:Queue.php

示例8: 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

示例9: 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

示例10: _getQueue

 /**
  * Get transport queue for current channel.
  * @return AMQPQueue
  */
 protected function _getQueue()
 {
     if (!$this->_queue) {
         //创建队列
         $this->_queue = new \AMQPQueue($this->_getChannel());
         //设置队列名字 如果不存在则添加
         $this->_queue->setName($this->_params['queue']);
         $this->_queue->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
         $this->_queue->declareQueue();
         //将你的队列绑定到routingKey
         $this->_queue->bind($this->_params['exchange'], $this->_params['router']);
     }
     return $this->_queue;
 }
开发者ID:mywin,项目名称:mywin,代码行数:18,代码来源:Rabbitmq.php

示例11: setUpAmqp

 /**
  * {@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.#');
 }
开发者ID:event-band,项目名称:band-transport-amqp-pecl,代码行数:18,代码来源:PeclAmqpDriverTest.php

示例12: setupConnection

 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];
 }
开发者ID:rsrodrig,项目名称:MeetMeSoftware,代码行数:15,代码来源:Utils.php

示例13: basic_consume

 /**
  * @param  string $queue
  * @param  string $consumer_tag
  * @param  bool $no_local
  * @param  bool $no_ack
  * @param  bool $exclusive
  * @param  bool $nowait
  * @param  callable $callback
  * @param  string $ticket
  * @param  array $arguments
  * @return mixed
  */
 public function basic_consume($queue = '', $consumer_tag = '', $no_local = false, $no_ack = false, $exclusive = false, $nowait = false, callable $callback = null, $ticket = null, $arguments = array())
 {
     $q = new \AMQPQueue($this->channel);
     $q->setName($queue);
     $q->declareQueue();
     $flags = AMQP_NOPARAM;
     $flags += $no_local ? AMQP_NOLOCAL : 0;
     $flags += $no_ack ? AMQP_AUTOACK : 0;
     $flags += $exclusive ? AMQP_EXCLUSIVE : 0;
     $flags += $nowait ? AMQP_NOWAIT : 0;
     $q->consume(function ($message, \AMQPQueue $q) use($callback, $flags, $consumer_tag) {
         $deliveryInfo = array('channel' => $q, 'delivery_tag' => '');
         return $callback(new AMQPMessage($message, array(), $deliveryInfo));
     }, $flags, $consumer_tag);
 }
开发者ID:remi-san,项目名称:universal-amqp,代码行数:27,代码来源:AMQPExtensionChannel.php

示例14: consume

 public function consume($queueName, $callBackFunction)
 {
     try {
         $queue = new AMQPQueue($this->channel);
         $queue->setName($queueName);
         $queue->setFlags(AMQP_DURABLE);
         $queue->declareQueue();
         echo ' [*] Waiting for messages on ' . $queueName . '. To exit press CTRL+C ', PHP_EOL;
         $queue->consume($callBackFunction);
     } catch (AMQPQueueException $ex) {
         print_r($ex);
     } catch (Exception $ex) {
         print_r($ex);
     }
 }
开发者ID:inilotic,项目名称:vks_nodes_core,代码行数:15,代码来源:AMQWrapper.class.php

示例15: initialize

 /**
  * @param \AMQPQueue|null $queue
  *
  * @throws HectorException
  */
 public function initialize(\AMQPQueue $queue = null)
 {
     if (true === $this->isInitialized()) {
         throw new HectorException('Queue already initialized');
     }
     if (null === $queue) {
         $queue = new \AMQPQueue($this->channel->getWrappedChannel());
     }
     $this->queue = $queue;
     $this->queue->setName($this->getName());
     $this->queue->bind($this->exchange->getName());
     $this->queue->setFlags($this->context->getFlags());
     $this->queue->setArguments($this->context->getArguments());
     $this->queue->declareQueue();
     $this->initialized = true;
 }
开发者ID:Evaneos,项目名称:Hector,代码行数:21,代码来源:Queue.php


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