@supportedBrokers(QPID, OPENAMQ)
    @inlineCallbacks
    def test_ack(self):
        channel = self.channel
        yield channel.queue_declare(queue="test-ack-queue", exclusive=True)

        reply = yield channel.basic_consume(queue="test-ack-queue", no_ack=False)
        queue = yield self.client.queue(reply.consumer_tag)

        channel.basic_publish(routing_key="test-ack-queue", content=Content("One"))
        channel.basic_publish(routing_key="test-ack-queue", content=Content("Two"))
        channel.basic_publish(routing_key="test-ack-queue", content=Content("Three"))
        channel.basic_publish(routing_key="test-ack-queue", content=Content("Four"))
        channel.basic_publish(routing_key="test-ack-queue", content=Content("Five"))

        msg1 = yield queue.get(timeout=1)
        msg2 = yield queue.get(timeout=1)
        msg3 = yield queue.get(timeout=1)
        msg4 = yield queue.get(timeout=1)
        msg5 = yield queue.get(timeout=1)

        self.assertEqual("One", msg1.content.body)
        self.assertEqual("Two", msg2.content.body)
        self.assertEqual("Three", msg3.content.body)
        self.assertEqual("Four", msg4.content.body)
        self.assertEqual("Five", msg5.content.body)

        channel.basic_ack(delivery_tag=msg2.delivery_tag, multiple=True)  #One & Two
        channel.basic_ack(delivery_tag=msg4.delivery_tag, multiple=False) #Four

        yield channel.basic_recover(requeue=False)

        msg3b = yield queue.get(timeout=1)
        msg5b = yield queue.get(timeout=1)

        self.assertEqual("Three", msg3b.content.body)
        self.assertEqual("Five", msg5b.content.body)

        try:
            extra = yield queue.get(timeout=1)
            self.fail("Got unexpected message: " + extra.content.body)
        except Empty: None
Test basic ack/recover behaviour
dataset/ETHPy150Open tweetdeck/txAMQP/src/txamqp/test/test_basic.py/BasicTests.test_ack