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


PHP Channel\AMQPChannel类代码示例

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


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

示例1: getChannel

 /**
  * Gets publisher AMQ channel
  *
  * @return AMQPChannel
  */
 protected function getChannel()
 {
     if (null === $this->channel) {
         $this->channel = $this->amq->channel();
         $this->channel->exchange_declare($this->exchange, 'topic', false, true, false);
     }
     return $this->channel;
 }
开发者ID:legolaiko,项目名称:amqp-smart-message,代码行数:13,代码来源:MessagePublisher.php

示例2:

 function it_releases_job_onto_rabbitmq(AMQPChannel $channel, RabbitMQQueue $queue)
 {
     // delete
     $channel->basic_ack('fooTagId')->shouldBeCalled();
     // release with attempts added into body
     $queue->later(1, 'foo', [0 => "someData", "attempts" => 1], 'default')->shouldBeCalled();
     $this->release(1);
 }
开发者ID:limedeck,项目名称:laravel-queue-rabbitmq,代码行数:8,代码来源:RabbitMQJobSpec.php

示例3: getChannel

 /**
  * Creates (if not yet created) and returns an AMQP channel.
  *
  * @return \PhpAmqpLib\Channel\AMQPChannel
  */
 protected function getChannel()
 {
     if (null === $this->channel) {
         $this->channel = $this->connection->channel();
         $this->channel->queue_declare($this->queueName, false, false, false, false);
         $this->channel->basic_qos(null, 1, null);
     }
     return $this->channel;
 }
开发者ID:smolowik,项目名称:concurrent-spider-bundle,代码行数:14,代码来源:Queue.php

示例4: getAmqpChannel

 /**
  * @return AMQPChannel
  */
 public function getAmqpChannel()
 {
     if ($this->amqp_channel) {
         return $this->amqp_channel;
     }
     $this->amqp_channel = $this->connection->getAmqpConnection()->channel();
     $this->amqp_channel->queue_declare($this->queue_config['queue_name'], false, $is_durable = true, false, false);
     $this->amqp_channel->basic_qos(null, $this->queue_config['fetch_count'], null);
     return $this->amqp_channel;
 }
开发者ID:lightster,项目名称:hodor,代码行数:13,代码来源:Channel.php

示例5: testDestruct

 public function testDestruct()
 {
     $this->channelMock->expects($this->once())->method('close');
     $this->clientMock->expects($this->once())->method('close');
     $queue = new MessageQueue($this->clientMock);
     unset($queue);
 }
开发者ID:picahielos,项目名称:mtp,代码行数:7,代码来源:MessageQueueTest.php

示例6: publishWithAMQP

 /**
  * @param DomainMessage $domainMessage
  */
 private function publishWithAMQP(DomainMessage $domainMessage)
 {
     $payload = $domainMessage->getPayload();
     $eventClass = get_class($payload);
     $this->logger->info("publishing message with event type {$eventClass} to exchange {$this->exchange}");
     $this->channel->basic_publish($this->messageFactory->createAMQPMessage($domainMessage), $this->exchange);
 }
开发者ID:cultuurnet,项目名称:broadway-amqp,代码行数:10,代码来源:AMQPPublisher.php

示例7: setupConnection

 protected function setupConnection()
 {
     Yii::trace('Connecting to broker...', __METHOD__);
     $this->connection = new AMQPConnection($this->host, $this->port, $this->user, $this->password, $this->vhost, $this->insist, $this->login_method, $this->login_response, $this->locale, $this->connection_timeout, $this->read_write_timeout, $this->context);
     $this->channel = $this->connection->channel();
     $this->channel->queue_declare($this->queue, false, true, false, false);
 }
开发者ID:highestgoodlikewater,项目名称:yii2-mailqueue,代码行数:7,代码来源:EmailTaskController.php

示例8: close

 /**
  * Close the running connection
  */
 public function close()
 {
     if (null !== $this->connection && $this->connection->isConnected()) {
         $this->channel->close();
         $this->connection->close();
     }
 }
开发者ID:graphaware,项目名称:php-simplemq,代码行数:10,代码来源:AbstractRunner.php

示例9: testQueueDeclaration

 /**
  * Test declaring a queue on the channel using the configured queue name
  */
 public function testQueueDeclaration()
 {
     $qName = 'queue_name';
     $this->setStubConfigData(['getQueueName' => $qName, 'getQueueConfiguration' => ['queue' => $qName, 'passive' => false, 'durable' => true, 'exclusive' => true, 'auto_delete' => true, 'nowait' => true]]);
     $this->channel->expects($this->once())->method('queue_declare')->with($this->identicalTo($qName));
     $this->invokeRestrictedMethod($this->amqpApi, 'declareQueue');
 }
开发者ID:ryaan-anthony,项目名称:RetailOrderManagement-SDK,代码行数:10,代码来源:AmqpApiTest.php

示例10: setUpAmqp

 protected function setUpAmqp()
 {
     $this->conn = new AMQPSocketConnection($_SERVER['AMQP_HOST'], $_SERVER['AMQP_PORT'], $_SERVER['AMQP_USER'], $_SERVER['AMQP_PASS'], $_SERVER['AMQP_VHOST']);
     $this->channel = $this->conn->channel();
     $this->channel->exchange_declare('event_band.test.exchange', 'topic');
     $this->channel->queue_declare('event_band.test.event');
     $this->channel->queue_bind('event_band.test.event', 'event_band.test.exchange', 'event.#');
 }
开发者ID:Gangstel,项目名称:EventBandAmqpLibTransport,代码行数:8,代码来源:AmqpLibDriverTest.php

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

示例12: getChannel

 private function getChannel()
 {
     if ($this->channel) {
         return $this->channel;
     }
     $this->channel = $this->connection->channel();
     $this->channel->queue_declare($this->queue, false, false, false, false);
     return $this->channel;
 }
开发者ID:tomaj,项目名称:hermes,代码行数:9,代码来源:LazyRabbitMqDriver.php

示例13: __destruct

 /**
  * Destructor.
  *
  * Closes RabbitMQ connection and channel if necessary.
  */
 public function __destruct()
 {
     if ($this->channel) {
         $this->channel->close();
     }
     if ($this->connection) {
         $this->connection->close();
     }
 }
开发者ID:Rahelno,项目名称:rfront,代码行数:14,代码来源:Receive.php

示例14: __destroy

 public function __destroy()
 {
     if ($this->_channel) {
         $this->_channel->close();
     }
     if ($this->getConnection && $this->getConnection->isConnected()) {
         $this->getConnection->close();
     }
 }
开发者ID:uafrica,项目名称:delayed-jobs,代码行数:9,代码来源:PhpAmqpLibDriver.php

示例15: tearDown

 public function tearDown()
 {
     if ($this->ch2) {
         $this->ch2->close();
     }
     if ($this->conn) {
         $this->conn->close();
     }
 }
开发者ID:vongrad,项目名称:loanbroker,代码行数:9,代码来源:Bug49Test.php


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