AMQPConnection::setVhost PHP Method

setVhost() public method

Sets the virtual host to which to connect on the AMQP broker.
public setVhost ( string $vhost ) : boolean
$vhost string The virtual host to use on the AMQP broker.
return boolean true on success or false on failure.
    public function setVhost($vhost)
    {
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (empty($this->user)) {
         throw new \Exception("Parameter 'user' was not set for AMQP connection.");
     }
     if (empty(self::$ampqConnection)) {
         self::$ampqConnection = new \AMQPConnection();
         self::$ampqConnection->setHost($this->host);
         self::$ampqConnection->setPort($this->port);
         self::$ampqConnection->setLogin($this->user);
         self::$ampqConnection->setPassword($this->password);
         self::$ampqConnection->setVhost($this->vhost);
         self::$ampqConnection->connect();
     }
 }
All Usage Examples Of AMQPConnection::setVhost