本文整理汇总了C#中Akka.Actor.Address.Should方法的典型用法代码示例。如果您正苦于以下问题:C# Address.Should方法的具体用法?C# Address.Should怎么用?C# Address.Should使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akka.Actor.Address
的用法示例。
在下文中一共展示了Address.Should方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JoinClusterWithOneOfflineSeedNode
public void JoinClusterWithOneOfflineSeedNode()
{
Within(TimeSpan.FromSeconds(30), () =>
{
RunOn(() =>
{
Sys.ActorOf(c => c.Receive<UniqueAddress>((address, ctx) =>
{
_seedUniqueAddress = address;
ctx.Sender.Tell("ok");
}), "address-receiver");
Sys.ActorOf(Props.Create(() => new DomainEventLogger()), "cluster-logger");
}, _config.NonSeed);
EnterBarrier("addr-receiver-ready");
RunOn(() =>
{
_seedUniqueAddress = Cluster.Get(_seedSystem.Value).SelfUniqueAddress;
_seedSystem.Value.ActorOf(Props.Create(() => new DomainEventLogger()), "clusterLogger");
var probe = CreateTestProbe(_seedSystem.Value);
_seedSystem.Value.ActorSelection(new RootActorPath(GetAddress(_config.NonSeed)) / "user" / "address-receiver").Tell(_seedUniqueAddress, probe.Ref);
probe.ExpectMsg("ok", TimeSpan.FromSeconds(5));
}, _config.Seed);
EnterBarrier("addr-transferred");
RunOn(() =>
{
Cluster.Get(_seedSystem.Value).JoinSeedNodes(SeedNodes);
AwaitCondition(() => Cluster.Get(_seedSystem.Value).ReadView.IsSingletonCluster);
_seedSystem.Value.ActorOf(Props.Create(() => new LeaderSynchronizer()), "leader-sync");
}, _config.Seed);
EnterBarrier("seed-self-joined");
RunOn(() =>
{
var unreachableNodeAddress = Cluster.Get(_unavailableSeedSystem.Value).SelfAddress;
// terminate the unreachableSeedNode
Shutdown(_unavailableSeedSystem.Value, RemainingOrDefault);
Cluster.JoinSeedNodes(SeedNodes.Add(unreachableNodeAddress)); // append the unreachable node address
AwaitMembersUp(2);
Sys.ActorOf(Props.Create(() => new LeaderSynchronizer()), "leader-sync");
}, _config.NonSeed);
EnterBarrier("formed-cluster");
/*
* Verify that both nodes agree on who the leader is
*/
RunOn(() =>
{
var addr2 = GetAddress(_config.NonSeed);
var probe2 = CreateTestProbe(_seedSystem.Value);
AwaitAssert(() =>
{
_seedSystem.Value.ActorSelection(new RootActorPath(addr2) / "user" / "leader-sync")
.Tell("leader", probe2.Ref);
_verifiedLeader = probe2.ExpectMsg<Address>();
_verifiedLeader.Should().Be(Cluster.Get(_seedSystem.Value).State.Leader);
});
}, _config.Seed);
RunOn(() =>
{
AwaitAssert(() =>
{
_verifiedLeader =
Sys.ActorSelection(new RootActorPath(SeedUniqueAddress.Address) / "user" / "leader-sync")
.Ask<Address>("leader")
.Result;
_verifiedLeader.Should().Be(Cluster.State.Leader);
});
}, _config.NonSeed);
EnterBarrier("verified-leader");
});
}