/** * 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); }
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; }