예제 #1
0
def create_router_with3_routees():
    routee1 = context.spawn(my_actor_props)
    routee2 = context.spawn(my_actor_props)
    routee3 = context.spawn(my_actor_props)

    props = Router.new_round_robin_group([routee1, routee2, routee3]) \
        .with_mailbox(MockMailbox)

    router = context.spawn(props)
    return router, routee1, routee2, routee3
예제 #2
0
async def run_round_robin_group_test():
    context = RootContext()
    props = Router.new_round_robin_group([context.spawn(my_actor_props),
                                          context.spawn(my_actor_props),
                                          context.spawn(my_actor_props),
                                          context.spawn(my_actor_props)])

    pid = context.spawn(props)
    for i in range(10):
        await context.send(pid, Message('%s' % (i % 4)))