示例#1
0
 def __init__(self, max_buf_len, topic, timeout, encoding, compress, seq):
     self.max_buf_len = max_buf_len
     self.encoding = encoding
     cmpz = False
     if compress.lower() == "true":
         cmpz = True
     sequence=False
     if seq.lower() =="true":
         sequence=True
     self.tunnel = tunnel(topic, cmpz, timeout, sequence)
示例#2
0
 def __init__(self, max_buf_len, topic, timeout, encoding, compress, seq):
     self.max_buf_len = max_buf_len
     self.encoding = encoding
     cmpz = False
     if compress.lower() == "true":
         cmpz = True
     sequence = False
     if seq.lower() == "true":
         sequence = True
     self.tunnel = tunnel(topic, cmpz, timeout, sequence)
示例#3
0
basepath = os.path.dirname(__file__)
logging.config.fileConfig(basepath + "/../conf/log.conf")


class PublishThread(threading.Thread):
    def __init__(self, t):
        self.id = id
        self.m = "aadfaddaffdf"
        self.t = t
        threading.Thread.__init__(self)

    def run(self):
        times = range(10)
        for i in times:
            time.sleep(1)
            post(self.t, self.m + str(i))


if __name__ == '__main__':
    use(passport("jiugao", "1111"))
    t = tunnel("t1")
    threads = []
    threadnum = range(10)
    for i in threadnum:
        pt = PublishThread(t)
        pt.start()
        threads.append(pt)

    [t.join() for t in threads]
    release()
示例#4
0
basepath = os.path.dirname(__file__)
logging.config.fileConfig(basepath + "/../conf/log.conf")

class PublishThread(threading.Thread):
    def __init__(self, t):
        self.id = id
        self.m = "aadfaddaffdf"
        self.t = t
        threading.Thread.__init__(self)
     
    def run(self):
        times = range(10)
        for i in times:
            time.sleep(1)
            post(self.t, self.m + str(i))


if __name__ == '__main__':
    use(passport("jiugao", "1111"))
    t = tunnel("t1")
    threads = []
    threadnum = range(10)
    for i in threadnum:
        pt = PublishThread(t)
        pt.start()
        threads.append(pt)
        
    [t.join() for t in threads] 
    release()