title: How to change RabbitMQ Heartbeat without restart
body: <p>There are several questions here in SO about RabbitMQ heartbeat but I haven't found one addressing how to actually change the default heartbeat value of <code>60 seconds</code> (<code>580 seconds</code> in previous versions).</p>
  
  <p>In the case when a consumer is running for longer than <code>60 seconds</code> and is incapable of producing any traffic that would count as heartbeat (for example <a href="https://github.com/php-amqplib/RabbitMqBundle/issues/301#issuecomment-144068134" rel="noreferrer">PHP consumers</a>), RabbitMQ will close the connection considering the consumer is dead, but the consumer might continue to run, and when it tries to produce the ACK the connection is closed and you get an error message like:  </p>
  
  <blockquote>
    <p>Broken pipe or closed connection</p>
  </blockquote>
  
  <p>One can set the heartbeat at the consumer side to a higher value, for example <code>1800 seconds</code>, but if the broker configuration is not changed, then the lower value will be use, in case of the default value then <code>60 seconds</code>. From RabbitMQ docs:</p>
  
  <blockquote>
    <p>The broker and client will attempt to negotiate heartbeats by default.
    When both values are non-0, the lower of the requested values will be
    used. If one side uses a zero value (attempts to disable heartbeats)
    but the other does not, the non-zero value will be used.</p>
  </blockquote>
  
  <p>To change the Heartbeat value one can add the following line in <code>/etc/rabbitmq/rabbitmq.conf</code> (using the <a href="https://www.rabbitmq.com/configure.html#config-file-formats" rel="noreferrer">new configuration format</a>)</p>
  
  <pre><code>heartbeat = 1800
  </code></pre>
  
  <p>This requires a restart, so the question is: <strong>How to change the rabbitmq heartbeat value without a restart?</strong></p>