A full example is in `demo/connection_recovery_consume.php`.
This code will reconnect and retry the application code every time the exception occurs. Some exceptions can still be thrown and should not be handled as a part of reconnection process, because they might be application errors.
This approach makes sense mostly for consumer applications, producers will require some additional application code to avoid publishing the same message multiple times.
This was a simplest example, in a real-life application you might want to control retr count and maybe gracefully degrade wait time to reconnection.
You can find a more excessive example in [#444](https://github.com/php-amqplib/php-amqplib/issues/444)