getChannel() public method

Get the AMQPChannel object in use
public getChannel ( ) : AMQPChannel
return AMQPChannel
Beispiel #1
0
 /**
  * Attempts to reconnect on a dead connection
  * Usable for long running processes, where the stale connections get collected
  * after some time
  *
  * @return void
  */
 protected function reconnect()
 {
     $connection = $this->exchange->getConnection();
     $channel = $this->exchange->getChannel();
     $connection->reconnect();
     // since the channel is also dead, need to somehow revive it. This can be
     // done only by calling the constructor of the channel
     $channel->__construct($connection);
 }
Beispiel #2
0
 /**
  * @return AMQPQueue
  */
 protected function declareAnonQueue()
 {
     // first declare the queue that we need for reply
     $queue = new AMQPQueue($this->exchange->getChannel());
     // declare an anon queue
     $queue->setFlags(AMQP_EXCLUSIVE);
     $queue->declareQueue();
     return $queue;
 }
 /**
  * @param \AMQPExchange $exchange
  * @return \AMQPQueue
  */
 protected function declareResponseQueue(\AMQPExchange $exchange)
 {
     $queue = new \AMQPQueue($exchange->getChannel());
     $queue->setFlags(AMQP_EXCLUSIVE);
     if ($this->queueTimeout !== null) {
         $queue->setArgument("x-expires", $this->queueTimeout);
     }
     $queue->declareQueue();
     return $queue;
 }
 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;
 }