Exemplo n.º 1
0
    def __init_broadcast_scheduler(self):
        scheduler = BroadcastScheduler(channel=ChannelProperty().name, self_target=ChannelProperty().peer_target)
        scheduler.start()

        self.__broadcast_scheduler = scheduler

        future = scheduler.schedule_job(BroadcastCommand.SUBSCRIBE, ChannelProperty().peer_target)
        future.result(conf.TIMEOUT_FOR_FUTURE)
Exemplo n.º 2
0
    def test_broadcast_process(self):
        ## GIVEN
        broadcast_scheduler = BroadcastScheduler()
        broadcast_scheduler.start()

        ## WHEN
        times = 0
        while times < 2:
            future = broadcast_scheduler.schedule_job("status", "param")
            print(f'broadcast_process status : {future.result()}')

            time.sleep(1)
            times += 1

        broadcast_scheduler.stop()
        broadcast_scheduler.wait()
Exemplo n.º 3
0
    def __start_broadcast_scheduler(self, channel):
        scheduler = BroadcastScheduler(channel=channel)
        scheduler.start()

        self.__broadcast_schedulers[channel] = scheduler
        return scheduler