Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import pika
  3.  
  4. connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
  5. channel = connection.channel()
  6.  
  7. channel.queue_declare(queue='hello')
  8.  
  9. def callback(ch, method, properties, body):
  10.     print(body)
  11.  
  12. channel.basic_consume(callback,
  13.                       queue='hello',
  14.                       no_ack=True)
  15.  
  16. print(' [*] Waiting for messages. To exit press CTRL+C')
  17. channel.start_consuming()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement