title: Pika - RabbitMQ - Why is my deliver-rate greater than acknowledge rate when using prefetch-count 1 for consumer
body: <p>I have a problem with the RabbitMQ implementation PIKA in Python.
  I want to consume 1 message from a queue, work with it and acknowledge it when the work is done. Then the next message should be received.</p>
  
  <p>I used the prefetch_count = 1 option, to tell rabbitMQ that this consumer only wants 1 message at a time and don't want a new message until this message is acknowledged.</p>
  
  <p>Here is my (very simple) code:</p>
  
  <pre><code>credentials = pika.PlainCredentials("username","password")
  connection = pika.BlockingConnection(
      pika.ConnectionParameters(host='1.2.3.4', credentials=credentials))
  channel = connection.channel()
  
  def consume(ch, method, properties, body):
      time.sleep(5) # Here is the work, now just hold 5 seconds
      ch.basic_ack(method.delivery_tag)
  
  def init():
      channel.basic_consume(
          queue="raw.archive", on_message_callback=consume, auto_ack=False)
      channel.basic_qos(prefetch_count=1)
      channel.start_consuming()
  
  if __name__ == "__main__":
      init()
  </code></pre>
  
  <p>So my question is, why does rabbitmq deliver more documents (40/sec) than acknowledged (0.20/sec, correct, because of 5 seconds pause). Shouldn't these two be equal?
  Furthermore the Unacked value (1650) should never be greater than 1, because it should not deliver any document, until this document gets acknowleged.</p>
  
  <p><a href="https://i.stack.imgur.com/kLw2K.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kLw2K.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/7tO1V.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7tO1V.jpg" alt="enter image description here"></a>
  The second view shows, that the consumer has no prefetch count. But the prefetch count is set on the connection. Maybe I must set it to the consumer, but I don't know, how to set this.</p>
  
  <p>What am I doing wrong? </p>
  
  <p>Thanks in advance.</p>