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


PHP AMQPExchange::getName方法代码示例

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


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

示例1: bind

 /**
  * Bind queue to exchange using dispatcher event names as routing keys
  *
  * @return void
  * @throws AMQPExchangeException
  */
 public function bind(\AMQPQueue $queue, \AMQPExchange $exchange)
 {
     $events = preg_grep($this->pattern, array_keys($this->getDispatcher()->getListeners()));
     foreach ($events as $eventName) {
         $queue->bind($exchange->getName(), $eventName);
     }
     $this->dispatcher->dispatch(static::BIND_EVENT, new SymfonyEvent($events, ["pattern" => $this->pattern, "exchange" => $exchange->getName(), "queue" => $queue->getName()]));
 }
开发者ID:gallna,项目名称:amqp-event,代码行数:14,代码来源:Consumer.php

示例2: receive

 /**
  * {@inheritDoc}
  */
 public function receive(array $eventNames, \Closure $callback)
 {
     $exchangeName = $this->exchange->getName();
     foreach ($eventNames as $eventName) {
         $this->queue->bind($exchangeName, $eventName);
     }
     $this->queue->consume(function (\AMQPEnvelope $envelope, \AMQPQueue $queue) use($callback) {
         $message = $envelope->getBody();
         $messageTag = $envelope->getDeliveryTag();
         $status = call_user_func($callback, $message);
         if ($status) {
             $queue->ack($messageTag);
         } else {
             $queue->nack($messageTag);
         }
     });
 }
开发者ID:Gtvar,项目名称:FivePercent-Notifier,代码行数:20,代码来源:AmqpAdapter.php

示例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;
 }
开发者ID:paulchyrilov,项目名称:zf2-rabbitmq-eventbus-module,代码行数:18,代码来源:EventBusAdapter.php

示例4: castExchange

 public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, $isNested)
 {
     $prefix = Caster::PREFIX_VIRTUAL;
     $a += array($prefix . 'name' => $c->getName(), $prefix . 'flags' => self::extractFlags($c->getFlags()), $prefix . 'type' => isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType(), $prefix . 'arguments' => $c->getArguments(), $prefix . 'channel' => $c->getChannel(), $prefix . 'connection' => $c->getConnection());
     return $a;
 }
开发者ID:alexey-shapilov,项目名称:zorca-cms,代码行数:6,代码来源:AmqpCaster.php

示例5: microtime

}
$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) {
    return --$consumer_iterations > 0;
}, AMQP_AUTOACK);
$timer = microtime(true) - $timer;
echo 'Consume: ', $iterations, ' iterations took ', $timer, 'sec', PHP_EOL;
$q->delete();
$exchange->delete();
开发者ID:vstepanyuk,项目名称:php-amqp,代码行数:31,代码来源:benchmark.php

示例6: getExchange

 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];
 }
开发者ID:IvixLabs,项目名称:RabbitmqBundle,代码行数:39,代码来源:ConnectionStorage.php

示例7: getName

 /**
  * @return string
  */
 public function getName()
 {
     return $this->rawExchange->getName();
 }
开发者ID:csharpru,项目名称:yii2-amqp,代码行数:7,代码来源:Exchange.php

示例8: getExchangeForQueue

 /**
  * @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;
 }
开发者ID:garbetjie,项目名称:laravel-amqp-queue,代码行数:19,代码来源:Queue.php

示例9: getName

 /**
  * @inheritdoc
  */
 public function getName()
 {
     return $this->delegate->getName();
 }
开发者ID:treehouselabs,项目名称:queue,代码行数:7,代码来源:Exchange.php

示例10: getName

 /**
  * @inheritdoc
  */
 public function getName() : string
 {
     return $this->exchange->getName() ?: '';
 }
开发者ID:prolic,项目名称:HumusAmqp,代码行数:7,代码来源:Exchange.php

示例11: send

 private function send($msg)
 {
     // Attach to well known server ETL and send message.
     $request_queue = new AMQPQueue($this->channel);
     $request_queue->setName("queue-well-known-rpc-name");
     $request_queue->declareQueue();
     $request_exch = new AMQPExchange($this->channel);
     $request_exch->setName("exchange-well-known-rpc-name");
     $request_exch->setType(AMQP_EX_TYPE_FANOUT);
     $request_exch->declareExchange();
     $request_queue->bind($request_exch->getName());
     $request_exch->publish($msg, null, AMQP_NOPARAM, ['correlation_id' => $this->correlation_id, 'reply_to' => $this->reply_queue->getName()]);
     $request_exch->delete();
 }
开发者ID:A-j-K,项目名称:php-amqp,代码行数:14,代码来源:tut-6-rpc.php


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