Esempio n. 1
0
class FanoutHarness(object):
    def setup(self):
        self.done = Countdown(10)
        self.fan = Fanout()
        self.subscriber_data = {}
        for x in xrange(10):
            diesel.fork(self.subscriber)
        diesel.sleep()
        for i in xrange(10):
            self.fan.pub(i)
        self.done.wait()

    def subscriber(self):
        self.subscriber_data[uuid.uuid4()] = data = []
        with self.fan.sub() as q:
            for i in xrange(10):
                data.append(q.get())
        self.done.tick()
Esempio n. 2
0
class FanoutHarness(object):
    def setup(self):
        self.done = Countdown(10)
        self.fan = Fanout()
        self.subscriber_data = {}
        for x in xrange(10):
            diesel.fork(self.subscriber)
        diesel.sleep()
        for i in xrange(10):
            self.fan.pub(i)
        self.done.wait()

    def subscriber(self):
        self.subscriber_data[uuid.uuid4()] = data = []
        with self.fan.sub() as q:
            for i in xrange(10):
                data.append(q.get())
        self.done.tick()