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


PHP AMQPQueue::getName方法代码示例

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


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

$connection = new AMQPConnection();
$connection->setHost('127.0.0.1');
$connection->setLogin('guest');
$connection->setPassword('guest');
$connection->connect();
//Create and declare channel
$channel = new AMQPChannel($connection);
try {
    //Declare Exchange
    $exchange_name = 'logs';
    $exchange = new AMQPExchange($channel);
    $exchange->setType(AMQP_EX_TYPE_FANOUT);
    $exchange->setName($exchange_name);
    $exchange->declareExchange();
    //Do not declasre the queue name by setting AMQPQueue::setName()
    $queue = new AMQPQueue($channel);
    $queue->setFlags(AMQP_EXCLUSIVE);
    $queue->declareQueue();
    $queue->bind($exchange_name, $queue->getName());
    echo sprintf("Queue Name: %s", $queue->getName()), PHP_EOL;
} catch (Exception $ex) {
    print_r($ex);
}
//Read from stdin
$message = implode(' ', array_slice($argv, 1));
if (empty($message)) {
    $message = "info: Hello World!";
}
$exchange->publish($message, '');
echo " [X] Sent {$message}", PHP_EOL;
$connection->disconnect();
开发者ID:CraryPrimitiveMan,项目名称:code-examples,代码行数:31,代码来源:emit_log.php

示例3: castQueue

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

示例4: getName

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

示例5: getName

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

示例6: function

$callback_func = function (AMQPEnvelope $message, AMQPQueue $q) use(&$max_jobs) {
    echo " [x] Received: ", $message->getBody(), PHP_EOL;
    sleep(1);
    $q->nack($message->getDeliveryTag());
};
try {
    //Declare Exchange
    $exchange_name = 'logs';
    $exchange = new AMQPExchange($channel);
    $exchange->setType(AMQP_EX_TYPE_FANOUT);
    $exchange->setName($exchange_name);
    $exchange->declareExchange();
    $queue = new AMQPQueue($channel);
    $queue->setFlags(AMQP_EXCLUSIVE);
    //allow server to define name
    $queue->declareQueue();
    $queue->bind($exchange_name, $queue->getName());
    echo ' [*] Waiting for logs. To exit press CTRL+C', PHP_EOL;
    $queue->consume($callback_func);
} catch (AMQPQueueException $ex) {
    print_r($ex);
} catch (AMQPExchangeException $ex) {
    print_r($ex);
} catch (AMQPChanncelException $ex) {
    print_r($ex);
} catch (AMQPConnectionException $ex) {
    print_r($ex);
} catch (Exception $ex) {
    print_r($ex);
}
$connection->disconnect();
开发者ID:rajkumarvenkatasamy,项目名称:rabbitmq-tutorials,代码行数:31,代码来源:receive_logs.php

示例7: getQueue

 /**
  * @param $name
  * @param string $channelName
  * @return \AMQPQueue
  */
 public function getQueue($name = 'default', $channelName = 'default')
 {
     $key = $channelName . '_' . $name;
     if (!isset($this->queues[$key])) {
         $channel = $this->getChannel($channelName);
         if (!isset($this->queuesSettings[$name])) {
             throw new \LogicException('No settings for queue ' . $name);
         }
         $settings = $this->queuesSettings[$name];
         $queue = new \AMQPQueue($channel);
         if ($settings['name'] !== null) {
             $queue->setName($settings['name']);
         }
         $queueFlags = AMQP_NOPARAM;
         if ($settings['durable']) {
             $queueFlags |= AMQP_DURABLE;
         }
         if ($settings['exclusive']) {
             $queueFlags |= AMQP_EXCLUSIVE;
         }
         if ($settings['autoDelete']) {
             $queueFlags |= AMQP_AUTODELETE;
         }
         if ($settings['passive']) {
             $queueFlags |= AMQP_PASSIVE;
         }
         $queue->setFlags($queueFlags);
         $queue->declareQueue();
         $this->queuesSettings[$name]['name'] = $queue->getName();
         $this->queues[$key] = $queue;
         //Warning place possible circular links
         if ($settings['from_exchanges'] !== null) {
             foreach ($settings['from_exchanges'] as $binExchangeName => $routingKeys) {
                 $bindExchange = $this->getExchange($binExchangeName, $channelName);
                 foreach ($routingKeys as $routingKey) {
                     $queue->bind($bindExchange->getName(), $routingKey);
                 }
             }
         }
     }
     return $this->queues[$key];
 }
开发者ID:IvixLabs,项目名称:RabbitmqBundle,代码行数:47,代码来源:ConnectionStorage.php

示例8: getQueueName

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

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

示例10: execute

 public function execute(\AMQPEnvelope $envelope, \AMQPQueue $queue)
 {
     echo 'Receive `' . $envelope->getBody() . '` from queue `' . $queue->getName() . '`' . PHP_EOL;
 }
开发者ID:umpirsky,项目名称:ko-worker,代码行数:4,代码来源:HelloWorld.php

示例11: declareQueue

 /**
  * Declare new queue in AMQP broker
  *
  * @param string $name Queue name
  * @param bool $durable Is queue durable
  * @param bool $exclusive Is queue exclusive
  *
  * @return string New queue name
  *
  * @throws ConnectionException
  * @throws \AMQPException
  */
 public function declareQueue($name, $durable = true, $exclusive = false)
 {
     try {
         $queue = new \AMQPQueue($this->getChannel());
         if ($name !== null) {
             $queue->setName((string) $name);
         }
         $flags = AMQP_NOPARAM;
         $flags |= $durable ? AMQP_DURABLE : AMQP_NOPARAM;
         $flags |= $exclusive ? AMQP_EXCLUSIVE : AMQP_NOPARAM;
         $queue->setFlags($flags);
         $queue->declareQueue();
         return $queue->getName();
     } catch (\AMQPConnectionException $e) {
         $this->channel = null;
         throw new ConnectionException($e->getMessage(), $e->getCode(), $e);
     } catch (\AMQPException $e) {
         $this->channel = null;
         throw $e;
     }
 }
开发者ID:helminster,项目名称:imgloader,代码行数:33,代码来源:AMQPClient.php

示例12: getName

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


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