Advertisement
Guest User

Untitled

a guest
Oct 6th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. q_connection = pika.BlockingConnection(
  2. pika.ConnectionParameters(
  3. host='127.0.0.1',
  4. virtual_host='/',
  5. credentials=pika.PlainCredentials(
  6. username='user',
  7. password='password'
  8. )
  9. )
  10. )
  11.  
  12. channel = q_connection.channel()
  13. channel.queue_declare(
  14. queue='processing',
  15. passive=False,
  16. durable=True,
  17. exclusive=False,
  18. auto_delete=False
  19. )
  20. channel.exchange_declare(exchange='router', type='direct', passive=False, durable=True, auto_delete=False)
  21. channel.queue_bind('processing', 'router')
  22.  
  23. def callback(ch, method, properties, body):
  24. # действия над полученными сообщениями
  25. ...
  26.  
  27. ch.basic_ack(delivery_tag=method.delivery_tag) # а вот тут периодически вылетает ошибка
  28.  
  29. channel.basic_consume(
  30. callback,
  31. queue='processing'
  32. )
  33. channel.start_consuming()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement