/**
* Attempts to reconnect on a dead connection
* Usable for long running processes, where the stale connections get collected
* after some time
*
* @return void
*/
protected function reconnect()
{
$connection = $this->exchange->getConnection();
$channel = $this->exchange->getChannel();
$connection->reconnect();
// since the channel is also dead, need to somehow revive it. This can be
// done only by calling the constructor of the channel
$channel->__construct($connection);
}