Exemple #1
0
 def client(self, host="mrt-lx1.iram.es", filter='require(ncs)',
            callback = deliver):
     if Debug>0:
         print >> sys.stderr, ".. connecting to ", host, ":",
     con = elvin.connect("elvin://" + host)
     if Debug>0:
         print >> sys.stderr, ".. connected"
     sub = con.subscribe(filter)
     sub.add_listener(callback)
     sub.register()
     con.run()
Exemple #2
0
 def __init__(self,host='mrt-lx1',require=''):
     """Initialize the messageReceiver class. It takes 3 arguments, 
     the elvin host, the deliver function and the require string to filter messages"""
     
     self.elvinHost=host
     
     connectTo = "elvin://%s" % self.elvinHost
     
     self.con = elvin.connect(connectTo)
     
     subscription = 'require(ncs)'
     self.require=require
     if self.require:
         subscription += ' && regex(LogId,"'+self.require+'")'
     if Debug>0: print ". subscription:", subscription
     sub = self.con.subscribe(subscription)
 
     sub.add_listener(self.deliverMsg)
     sub.register()
     
     print 'reading from Elvin, host: '+self.elvinHost