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


PHP AMQPChannel::wait方法代码示例

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


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

示例1: waitingForCall

 public function waitingForCall()
 {
     $this->channel->basic_consume(self::QUEUE_NAME, '', false, false, false, false, array($this, 'receive'));
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
 }
开发者ID:eugenegp,项目名称:uzticketstat,代码行数:7,代码来源:RabbitMq.php

示例2: resolve

 /**
  * @param Invoker\Reply $reply
  * @param float         $timeout
  *
  * @return $this
  */
 public function resolve(Invoker\Reply $reply, $timeout = null)
 {
     while (!empty($this->channel->callbacks) && !$this->isResolved($reply)) {
         $this->channel->wait(null, true, $timeout);
     }
     return $this;
 }
开发者ID:skolodyazhnyy,项目名称:message-bus-client,代码行数:13,代码来源:Invoker.php

示例3: consume

 public function consume(ConsumerInterface $consumer, $callback)
 {
     $this->channel->basic_consume($consumer->getName(), '', false, false, false, false, $callback);
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
 }
开发者ID:roryy,项目名称:flatfishqueue,代码行数:7,代码来源:Channel.php

示例4: wait

 public function wait()
 {
     // Loop as long as the channel has callbacks registered
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
 }
开发者ID:NoUseFreak,项目名称:WebProxy,代码行数:7,代码来源:QueueHelper.php

示例5: listen

 /**
  * Infinite loop: Listens for messages from the queue and sends them to the callback.
  *
  * @param callback $callback
  */
 public function listen($callback)
 {
     $this->channel->basic_qos(null, 1, null);
     $this->channel->basic_consume(self::QUEUE_NAME, '', false, true, false, false, $callback);
     while ($this->channel->callbacks) {
         $this->channel->wait();
     }
 }
开发者ID:picahielos,项目名称:mtp,代码行数:13,代码来源:MessageQueue.php

示例6: consume

 /**
  * @param string $exchangeName
  * @param callable $callback
  */
 public function consume($exchangeName, callable $callback)
 {
     $this->callback = $callback;
     $this->channel->basic_consume($exchangeName, '', false, true, false, false, [$this, 'callback']);
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
 }
开发者ID:zoek1,项目名称:php-testing-tools,代码行数:12,代码来源:AmqpMessageConsumer.php

示例7: consume

 /**
  * Consumes one event and calls callback for it.
  *
  * @param integer $timeout Optional timeout in seconds. Default is no timeout.
  *
  * @return void
  */
 public function consume($timeout = 0)
 {
     try {
         $this->channel->wait(null, false, $timeout);
     } catch (AMQPTimeoutException $e) {
         return;
     }
 }
开发者ID:scalr,项目名称:fatmouse-phpclient,代码行数:15,代码来源:Consumer.php

示例8: listen

 /**
  * Listen declared queues
  * @param null $cliMessage
  */
 public function listen($cliMessage = null)
 {
     if (!empty($cliMessage)) {
         echo $cliMessage;
     }
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
 }
开发者ID:ysaroka,项目名称:uploader,代码行数:13,代码来源:AmqpReceiver.php

示例9: consume

 public function consume()
 {
     $queue = $this->initialize();
     $tag = $this->handler->name();
     $this->channel->basic_consume($queue, $tag, false, false, false, false, [$this, 'handle']);
     while (isset($this->channel->callbacks[$tag])) {
         $this->channel->wait();
     }
 }
开发者ID:skolodyazhnyy,项目名称:message-bus-client,代码行数:9,代码来源:Consumer.php

示例10: testPublishConsume

 public function testPublishConsume()
 {
     $this->msg_body = 'foo bar baz äëïöü';
     $msg = new AMQPMessage($this->msg_body, array('content_type' => 'text/plain', 'delivery_mode' => 1, 'correlation_id' => 'my_correlation_id', 'reply_to' => 'my_reply_to'));
     $this->ch->basic_publish($msg, $this->exchange_name, $this->queue_name);
     $this->ch->basic_consume($this->queue_name, getmypid(), false, false, false, false, array($this, 'process_msg'));
     while (count($this->ch->callbacks)) {
         $this->ch->wait();
     }
 }
开发者ID:vongrad,项目名称:loanbroker,代码行数:10,代码来源:AbstractPublishConsumeTest.php

示例11: testSendFile

 public function testSendFile()
 {
     $this->msg_body = file_get_contents(__DIR__ . '/fixtures/data_1mb.bin');
     $msg = new AMQPMessage($this->msg_body, array('delivery_mode' => 1));
     $this->ch->basic_publish($msg, $this->exchange_name, $this->queue_name);
     $this->ch->basic_consume($this->queue_name, '', false, false, false, false, array($this, 'process_msg'));
     while (count($this->ch->callbacks)) {
         $this->ch->wait();
     }
 }
开发者ID:vongrad,项目名称:loanbroker,代码行数:10,代码来源:FileTransferTest.php

示例12: consume

 /**
  * @param callable $callback
  * @return void
  */
 public function consume(callable $callback)
 {
     $internCallback = function ($msg) use($callback) {
         //echo " [x] Received ", $msg->body, "\n";
         $callback(unserialize($msg->body));
     };
     $this->exchange->basic_consume($this->exchangeName, '', false, true, false, false, $internCallback);
     while (count($this->exchange->callbacks)) {
         $this->exchange->wait();
     }
 }
开发者ID:wildpascal,项目名称:remote-event-dispatcher,代码行数:15,代码来源:AmqpHandler.php

示例13: call

 /**
  * @param $n
  * @return int
  */
 public function call($n)
 {
     $this->response = null;
     $this->corr_id = uniqid();
     $msg = new AMQPMessage((string) $n, ['correlation_id' => $this->corr_id, 'reply_to' => $this->callback_queue]);
     $this->channel->basic_publish($msg, '', 'rpc_queue');
     while (!$this->response) {
         $this->channel->wait();
     }
     return intval($this->response);
 }
开发者ID:seyfer,项目名称:rabbitmq-learn,代码行数:15,代码来源:rpc_client.php

示例14: consume

 /**
  * @param string $queue
  * @param string $exchange
  * @param string $routingKey
  * @param callable $callback
  */
 public function consume($queue, $exchange, $routingKey, $callback)
 {
     $this->declareComponents($routingKey, $exchange, $queue);
     $this->channel->basic_consume($queue, '', false, false, false, false, function ($amqpMessage) use($callback) {
         $message = new Message($amqpMessage);
         $callback($message);
     });
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
 }
开发者ID:ajouve,项目名称:rabbit-mq-wrapper,代码行数:17,代码来源:Client.php

示例15: wait

 /**
  * {@inheritdoc}
  */
 public function wait(Closure $callback)
 {
     $this->channel->basic_consume($this->queue, '', false, true, false, false, function ($rabbitMessage) use($callback) {
         $message = $this->serializer->unserialize($rabbitMessage->body);
         $callback($message);
         $rabbitMessage->delivery_info['channel']->basic_ack($rabbitMessage->delivery_info['delivery_tag']);
     });
     while (count($this->channel->callbacks)) {
         $this->channel->wait();
     }
 }
开发者ID:tomaj,项目名称:hermes,代码行数:14,代码来源:RabbitMqDriver.php


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