How to reconnect to RabbitMQ? : <p>My python script constantly has to send messages to RabbitMQ once it receives one from another data source. The frequency in which the python script sends them can vary, say, 1 minute - 30 minutes.</p>

<p>Here's how I establish a connection to RabbitMQ:</p>

<pre><code>  rabt_conn = pika.BlockingConnection(pika.ConnectionParameters("some_host"))
  channel = rbt_conn.channel()
</code></pre>

<p>I just got an exception </p>

<pre><code>pika.exceptions.ConnectionClosed
</code></pre>

<p>How can I reconnect to it? What's the best way? Is there any "strategy"? Is there an ability to send pings to keep a connection alive or set timeout?</p>

<p>Any pointers will be appreciated.</p>
