import pika def callback(ch, method, properties, body): print(" [ X ] Received % r " % body ) credentials = pika.PlainCredentials('Justin', 'Justin@Saran2001') parameters = pika.ConnectionParameters('rabbitmq.selfmade.ninja', 5672, 'justinmass2001_Amutha', credentials) connection = pika.BlockingConnection(parameters) channel = connection.channel() channel.queue_declare(queue='my_first_queue') channel.basic_consume(queue='my_first_queue', auto_ack=True, on_message_callback=callback) print(' [*] Waiting for messages. To exit press CTRL+C') channel.start_consuming()