import pika
connection = pika.BlockingConnection(
pika.ConnectionParameters(
host='HostName',
port=5672,
virtual_host='VHost',
credentials=pika.PlainCredentials('<UserName>', '<Password>')
)
)
channel = connection.channel()
def callback(ch, method, properties, body):
print("Received message: %r" % body)
channel.basic_consume(queue='_<package_id>_', on_message_callback=callback, auto_ack=True)
print("Waiting for messages...")
channel.start_consuming()