Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import pika
  3.  
  4. url = os.environ.get('QUEUE_URL')
  5. params = pika.URLParameters(url)
  6. params.socket_timeout = 5
  7.  
  8. connection = pika.BlockingConnection(params)
  9. channel = connection.channel()
  10.  
  11. channel.queue_declare(queue='hello')
  12.  
  13. def callback(ch, method, properties, body):
  14. print(" [x] Received %r" % body)
  15.  
  16. channel.basic_consume(callback,
  17. queue='hello',
  18. no_ack=True)
  19.  
  20. print(' [*] Waiting for messages. To exit press CTRL+C')
  21. channel.start_consuming()
  22.  
  23. pika.exceptions.ProbableAuthenticationError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement