AMQPConnection::disconnect PHP Method

disconnect() public method

This method will close an open connection with the AMQP broker.
public disconnect ( ) : boolean
return boolean true if connection was successfully closed, false otherwise.
    public function disconnect()
    {
    }

Usage Example

 /**
  * @param array $event
  * @return bool
  */
 public function publish($event = [])
 {
     try {
         if (!$this->connection->isConnected()) {
             $this->connection->connect();
         }
         list($message, $attributes) = $this->prepareMessage($event);
         $result = $this->getExchange()->publish($message, null, AMQP_NOPARAM, $attributes);
         $this->connection->disconnect();
         return $result;
     } catch (\Exception $e) {
         return false;
     }
 }
All Usage Examples Of AMQPConnection::disconnect