Bug fix, with router in transport class and actor hierarchy

community
Steve L. Nyemba 8 years ago
parent e3a0e6e8b0
commit 7423f6a9ec

@ -20,6 +20,10 @@ class Actor(Thread):
Thread.__init__(self)
self.config = config
self.items = []
self.__id = config['id']
def getIdentifier(self):
return self.__id
def init(self,litems):
self.items = litems
def process(self,item):
@ -33,7 +37,17 @@ class Actor(Thread):
pass
return stream
def callback(self,channel,method,header,stream):
print stream
print [self.getIdentifier(),stream]
#message = None
#try:
#message = json.loads(stream)
#except Exception, e:
#pass
#if message is not None:
#if 'id' in message :
#if 'payload' in message:
#self.execute(message['payload']
def run(self):
info = {}
@ -69,3 +83,7 @@ class Alert(Actor):
config = {"id":"demo","key":"[0v8]-247&7!v3","api":"localhost"}
actor = Kill(config)
actor.start()
config = {"id":"demo-100","key":"[0v8]-247&7!v3","api":"localhost"}
actor_1 = Kill(config)
actor_1.start()

@ -410,7 +410,6 @@ class QueueReader(MessageQueue,Reader):
pass
#self.close()
# r[qid].append( self.data)
return self.data
@ -419,10 +418,11 @@ class QueueListener(QueueReader):
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.channel.exchange_declare(exchange=self.uid,type='direct' )
self.info = self.channel.queue_declare(queue=qid,exclusive=True)
self.channel.queue_bind(exchange=self.uid,queue=self.info.method.queue)
self.info = self.channel.queue_declare(exclusive=True,queue=qid)
print self.info.method.queue
self.channel.queue_bind(exchange=self.uid,queue=self.info.method.queue,routing_key=qid)
#self.callback = callback
def read(self):

Loading…
Cancel
Save