|
|
|
@ -359,8 +359,7 @@ class QueueReader(MessageQueue,Reader):
|
|
|
|
|
self.channel = self.connection.channel()
|
|
|
|
|
self.channel.exchange_declare(exchange=self.uid,type='direct',durable=True)
|
|
|
|
|
|
|
|
|
|
self.info = self.channel.queue_
|
|
|
|
|
declare(queue=qid,durable=True)
|
|
|
|
|
self.info = self.channel.queue_declare(queue=qid,durable=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -416,15 +415,20 @@ declare(queue=qid,durable=True)
|
|
|
|
|
|
|
|
|
|
return self.data
|
|
|
|
|
class QueueListener(QueueReader):
|
|
|
|
|
def init(self,qid,callback):
|
|
|
|
|
def init(self,qid):
|
|
|
|
|
properties = pika.ConnectionParameters(host=self.host)
|
|
|
|
|
self.connection = pika.BlockingConnection(properties)
|
|
|
|
|
self.channel = self.connection.channel()
|
|
|
|
|
self.channel.exchange_declare(exchange=self.uid,type='fanout')
|
|
|
|
|
|
|
|
|
|
self.info = self.channel.queue_declare(queue=qid,exclusive=True)
|
|
|
|
|
self.channel.queue_bind(exchange=self.uid,queue=self.info.method.queue,no_ack=True)
|
|
|
|
|
self.callback = callback
|
|
|
|
|
self.channel.queue_bind(exchange=self.uid,queue=self.info.method.queue)
|
|
|
|
|
#self.callback = callback
|
|
|
|
|
def read(self):
|
|
|
|
|
|
|
|
|
|
self.init(self.qid)
|
|
|
|
|
self.channel.basic_consume(self.callback,queue=self.qid,no_ack=True);
|
|
|
|
|
self.channel.start_consuming()
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
This class is designed to write output as sql insert statements
|
|
|
|
|