public void ConsistentHashingGroup_must_use_same_hash_ring_indepenent_of_self_address() { // simulating running router on two different nodes (a1, a2) with target routees on 3 other nodes (s1, s2, s3) var a1 = new Address("akka.tcp", "Sys", "client1", 2552); var a2 = new Address("akka.tcp", "Sys", "client2", 2552); var s1 = new ActorSelectionRoutee(Sys.ActorSelection("akka.tcp://Sys@server1:2552/user/a/b")); var s2 = new ActorSelectionRoutee(Sys.ActorSelection("akka.tcp://Sys@server2:2552/user/a/b")); var s3 = new ActorSelectionRoutee(Sys.ActorSelection("akka.tcp://Sys@server3:2552/user/a/b")); var nodes1 = new List<ConsistentRoutee>(new [] { new ConsistentRoutee(s1, a1), new ConsistentRoutee(s2, a1), new ConsistentRoutee(s3, a1)}); var nodes2 = new List<ConsistentRoutee>(new[] {new ConsistentRoutee(s1, a2), new ConsistentRoutee(s2, a2), new ConsistentRoutee(s3, a2)}); var consistentHash1 = ConsistentHash.Create(nodes1, 10); var consistentHash2 = ConsistentHash.Create(nodes2, 10); var keys = new List<string>(new [] { "A", "B", "C", "D", "E", "F", "G"}); var result1 = keys.Select(k => consistentHash1.NodeFor(k).Routee); var result2 = keys.Select(k => consistentHash2.NodeFor(k).Routee); Assert.Equal(result2,result1); }
protected bool Equals(ActorSelectionRoutee other) { return(Equals(_actor, other._actor)); }
/// <inheritdoc/> protected bool Equals(ActorSelectionRoutee other) => Equals(_actor, other._actor);
public void Round_robin_pool_must_be_controlled_with_management_messages() { IActorRef actor = Sys.ActorOf(new RandomPool(3) .Props(Props.Create<EmptyBehaviorActor>()), "round-robin-managed"); RouteeSize(actor).Should().Be(3); actor.Tell(new AdjustPoolSize(4)); RouteeSize(actor).Should().Be(7); actor.Tell(new AdjustPoolSize(-2)); RouteeSize(actor).Should().Be(5); var other = new ActorSelectionRoutee(Sys.ActorSelection("/user/other")); actor.Tell(new AddRoutee(other)); RouteeSize(actor).Should().Be(6); actor.Tell(new RemoveRoutee(other)); RouteeSize(actor).Should().Be(5); }
protected bool Equals(ActorSelectionRoutee other) { return Equals(_actor, other._actor); }
/// <inheritdoc/> protected bool Equals(ActorSelectionRoutee other) => Equals(Selection, other.Selection);