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

Merge branch 'meeting-update' into 'rabbitmq-base-poducer-consumer'

Quick update with consumers

See merge request mmoo97/flask_user_reg!33
parents 4646d2eb 2487e583
No related branches found
No related tags found
3 merge requests!35Version 1b openstack rabbitmq,!33Quick update with consumers,!30Refine Producer/Consumers Data Handling
......@@ -18,6 +18,7 @@ print(' [*] Waiting for logs. To exit press CTRL+C')
def callback(ch, method, properties, body):
print(" [x] %r:%r" % (method.routing_key, body))
print('[manager] User creation task is done.')
# Todo: Make message manager more functional
......
......@@ -19,6 +19,10 @@ print(' [*] Waiting for logs. To exit press CTRL+C')
def callback(ch, method, properties, body):
print(" [x] %r:%r" % (method.routing_key, body))
# Todo: Make message manager more functional
print('[ohpc] User has been created')
channel.basic_publish(
exchange='direct_logs', routing_key="ood", body='{uid:1002,gid:1002}')
print(" [x] Sent %r:%r" % ("ood", '{uid:1002, gid:1002}'))
channel.basic_consume(
......
#!/usr/bin/env python
import pika # python client
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost')) # connecting to a broker on the local machine
credentials = pika.PlainCredentials('reggie', 'reggie')
parameters = pika.ConnectionParameters('ohpc',
5672,
'/',
credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.exchange_declare(exchange='direct_logs', exchange_type='direct') # create exchange to pass messages
......@@ -17,11 +21,12 @@ print(' [*] Waiting for logs. To exit press CTRL+C')
def callback(ch, method, properties, body):
message = "ood sent this"
channel.basic_publish(
exchange='direct_logs', routing_key="manager", body=message)
print(" [x] %r:%r" % (method.routing_key, body))
# Todo: Make message manager more functional
print('[ood] User has been created')
channel.basic_publish(
exchange='direct_logs', routing_key="manager", body='{status:"done"}')
print(" [x] Sent %r:%r" % ("manager", '{status:done}'))
channel.basic_consume(
......
......@@ -8,14 +8,10 @@ channel = connection.channel()
channel.exchange_declare(exchange='direct_logs', exchange_type='direct')
message = "Hey there" # todo: account info goes here
message = "Hey need an account here" # todo: account info goes here
channel.basic_publish(
exchange='direct_logs', routing_key="ohpc", body=message)
print(" [x] Sent %r:%r" % ("ohpc", message))
channel.basic_publish(
exchange='direct_logs', routing_key="ood", body=message)
print(" [x] Sent %r:%r" % ("ood", message))
connection.close()
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