aboutsummaryrefslogtreecommitdiffstats
path: root/rmq.py
diff options
context:
space:
mode:
Diffstat (limited to 'rmq.py')
-rw-r--r--rmq.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/rmq.py b/rmq.py
index 72e0e9a..ebb9e6d 100644
--- a/rmq.py
+++ b/rmq.py
@@ -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)