Using Delivery Confirmations with the BlockingConnectionΒΆ

The following code demonstrates how to turn on delivery confirmations with the BlockingConnection and how to check for confirmation from RabbitMQ:

import pika

# Open a connection to RabbitMQ on localhost using all default parameters
connection = pika.BlockingConnection()

# Open the channel
channel =

# Declare the queue
channel.queue_declare(queue="test", durable=True, exclusive=False, auto_delete=False)

# Turn on delivery confirmations

# Send a message
if channel.basic_publish(exchange='test',
                         body='Hello World!',
    print 'Message publish was confirmed'
    print 'Message could not be confirmed'

Project Versions

Previous topic

Comparing Message Publishing with BlockingConnection and SelectConnection

Next topic

Ensuring message delivery with the mandatory flag

This Page