Skip to content
Snippets Groups Projects
Commit a3fc9d30 authored by Mitchell Moore's avatar Mitchell Moore
Browse files

Fix connection parameters for cluster

parent 362c1f8d
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python #!/usr/bin/env python
import pika # python client import pika # python client
import sys import sys
connection = pika.BlockingConnection( credentials = pika.PlainCredentials('reggie', 'reggie')
pika.ConnectionParameters(host='localhost')) # connecting to a broker on the local machine parameters = pika.ConnectionParameters('ood',
5672,
'/',
credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel() channel = connection.channel()
channel.exchange_declare(exchange='direct_logs', exchange_type='direct') # create exchange to pass messages channel.exchange_declare(exchange='direct_logs', exchange_type='direct') # create exchange to pass messages
...@@ -28,7 +33,6 @@ def callback(ch, method, properties, body): ...@@ -28,7 +33,6 @@ def callback(ch, method, properties, body):
print('[%r] User creation task is done.' % method.routing_key) print('[%r] User creation task is done.' % method.routing_key)
channel.basic_consume( channel.basic_consume(
queue=queue_name, on_message_callback=callback, auto_ack=True) # ingest messages, and assume delivered via auto_ack queue=queue_name, on_message_callback=callback, auto_ack=True) # ingest messages, and assume delivered via auto_ack
......
...@@ -2,8 +2,14 @@ import pika ...@@ -2,8 +2,14 @@ import pika
import sys import sys
# Begin RabbitMQ process. # Begin RabbitMQ process.
connection = pika.BlockingConnection( credentials = pika.PlainCredentials('reggie', 'reggie')
pika.ConnectionParameters(host='localhost')) parameters = pika.ConnectionParameters('ood',
5672,
'/',
credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel() channel = connection.channel()
channel.exchange_declare(exchange='direct_logs', exchange_type='direct') channel.exchange_declare(exchange='direct_logs', exchange_type='direct')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment