(No version information available, might only be in SVN)
AMQPConnection::reconnect — Closes any open connection and creates a new connection with the AMQP broker.
This method will close any open connections and initiate a new connection with the AMQP broker.
void
Returns true if reconnect was successful, false otherwise.
Beispiel #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');
}
?>