AMQPConnection::reconnect
(No version information available, might only be in SVN)
AMQPConnection::reconnect — Closes any open connection and creates a new connection with the AMQP broker.
Description
public boolean AMQPConnection::reconnect
( void
)
This method will close any open connections and initiate a new connection with the AMQP broker.
Parameters
void
Return Values
Returns true if reconnect was successful, false otherwise.
Examples
Example #1 AMQPConnection::reconnect() example
<?php
/* Create a new connection */
$cnn = new AMQPConnection();
// set the login details
$cnn->setLogin('mylogin');
$cnn->setPassword('mypass');
if (!$cnn->connect()) {
throw new Exception('Could not connect');
}
// do something interesting
// ensure we have a valid connection
if (!$cnn->reconnect()) {
throw new Exception('Could not reconnect');
}
?>