diff options
Diffstat (limited to 'rmq.py')
-rw-r--r-- | rmq.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -15,7 +15,8 @@ from config import USERNAME from logs import log -class Rmq(object): +class Rmq: + """Rabbit MQ (RMQ) implementation used for communication with the bot.""" def __init__(self, username=USERNAME, @@ -41,6 +42,7 @@ class Rmq(object): auto_delete=True) # Delete queue when all connection are closed def consume(self, queue=QUEUE, callback=None, thread_ws=None, run_once=False): + """Subscribe to read from a RMQ channel.""" while True: try: connection = pika.BlockingConnection(self.con_params) @@ -85,11 +87,8 @@ class Rmq(object): time.sleep(2) - def publish(self, - message, - queue=QUEUE, - routingkey=ROUTING_KEY, - exchange=EXCHANGE): + def publish(self, message, queue=QUEUE, routingkey=ROUTING_KEY, exchange=EXCHANGE): + """Open a connection to publish (write) to a RMQ channel.""" try: connection = pika.BlockingConnection(self.con_params) |