예제 #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)
예제 #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()