/** @return AMQPLazyConnection */ private function getConnection(Connection $connection) { $name = $connection->getName(); if (isset($this->connections[$name])) { return $this->connections[$name]; } $connection = new AMQPLazyConnection($connection->getHost(), $connection->getPort(), $connection->getLogin(), $connection->getPassword(), $connection->getVhost()); $connection->set_close_on_destruct(true); return $this->connections[$name] = $connection; }