Exemple #1
0
 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;
 }
 /** @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;
 }
 /**
  * Disconnect from queue.
  */
 public function disconnect()
 {
     $this->channel->close();
     $this->connection->close();
 }