|
|
|
@ -345,6 +345,10 @@ class QueueReader(MessageQueue,Reader):
|
|
|
|
|
#self.uid = params['uid']
|
|
|
|
|
#self.qid = params['qid']
|
|
|
|
|
MessageQueue.__init__(self,**params);
|
|
|
|
|
if 'durable' in params :
|
|
|
|
|
self.durable = True
|
|
|
|
|
else:
|
|
|
|
|
self.durable = False
|
|
|
|
|
self.size = -1
|
|
|
|
|
self.data = {}
|
|
|
|
|
|
|
|
|
@ -355,7 +359,8 @@ 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -410,6 +415,16 @@ class QueueReader(MessageQueue,Reader):
|
|
|
|
|
# r[qid].append( self.data)
|
|
|
|
|
|
|
|
|
|
return self.data
|
|
|
|
|
class QueueListener(QueueReader):
|
|
|
|
|
def init(self,qid,callback):
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
This class is designed to write output as sql insert statements
|
|
|
|
|