コード例 #1
0
def create_broadcast_group_router_with3_routees():
    routee1 = context.spawn(my_actor_props)
    routee2 = context.spawn(my_actor_props)
    routee3 = context.spawn(my_actor_props)

    props = Router.new_broadcast_group([routee1, routee2, routee3])
    router = context.spawn(props)
    return router, routee1, routee2, routee3
コード例 #2
0
ファイル: router.py プロジェクト: acolley/protoactor-python
async def run_broadcast_group_test():
    context = RootContext()
    props = Router.new_broadcast_group([context.spawn(my_actor_props),
                                        context.spawn(my_actor_props),
                                        context.spawn(my_actor_props),
                                        context.spawn(my_actor_props)])

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