async def run_consistent_hash_group_test(): context = RootContext() props = Router.new_consistent_hash_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)))
def create_broadcast_group_router_with3_routees(): routee1 = context.spawn_named(my_actor_props, str(uuid.uuid4()) + 'routee1') routee2 = context.spawn_named(my_actor_props, str(uuid.uuid4()) + 'routee2') routee3 = context.spawn_named(my_actor_props, str(uuid.uuid4()) + 'routee3') props = Router.new_consistent_hash_group( [routee1, routee2, routee3], SuperIntelligentDeterministicHash.hash, 1) router = context.spawn(props) return router, routee1, routee2, routee3