當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。