Permalink
Browse files

Always get RabbitMQ queue name from settings.

  • Loading branch information...
1 parent fa1f7da commit a4152495d12b1d9499b8db97999eff6e819d553a @calumhalcrow calumhalcrow committed Dec 19, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −2 chat/chatroom.py
  2. +3 −2 frontend/events/signals.py
View
@@ -38,8 +38,7 @@ class PikaClient(Observable):
def __init__(self):
Observable.__init__(self)
- #self.queue_name = settings.RABBITMQ_QUEUE_NAME
- self.queue_name = 'hello'
+ self.queue_name = settings.RABBITMQ_QUEUE_NAME
# States
self.connected = False
@@ -11,9 +11,10 @@ def publish(data):
connection_parameters = PikaClient().connection_parameters()
connection = pika.BlockingConnection(pika.ConnectionParameters(**connection_parameters))
channel = connection.channel()
- channel.queue_declare(queue=settings.RABBITMQ_QUEUE_NAME)
+ queue_name = settings.RABBITMQ_QUEUE_NAME
+ channel.queue_declare(queue=queue_name)
- channel.basic_publish(exchange='', routing_key='hello', body=data)
+ channel.basic_publish(exchange='', routing_key=queue_name, body=data)
print ' [x] Data sent to queue: {0}'.format(data)
connection.close()

0 comments on commit a415249

Please sign in to comment.