private Actors(Config config) { _system = ActorSystem.Create(Constants.SystemName, config); var sharding = ClusterSharding.Get(_system); var settings = ClusterShardingSettings .Create(_system) .WithRole(Constants.ClusterNodeRoleName); ShardRegion = sharding.Start( typeName: Customer.TypeName, entityProps: Props.Create <Customer>(), settings: settings, messageExtractor: new MessageExtractor()); }
protected ClusterShardingFailureSpec(ClusterShardingFailureSpecConfig config, Type type) : base(config, type) { _config = config; _region = new Lazy <IActorRef>(() => ClusterSharding.Get(Sys).ShardRegion("Entity")); _storageLocations = new List <FileInfo> { new FileInfo(Sys.Settings.Config.GetString("akka.cluster.sharding.distributed-data.durable.lmdb.dir")) }; IsDDataMode = config.Mode == "ddata"; DeleteStorageLocations(); EnterBarrier("startup"); }
private static void RunExample(ActorSystem system) { var sharding = ClusterSharding.Get(system); var shardRegion = sharding.Start( typeName: "customer", entityProps: Props.Create <Customer>(), settings: ClusterShardingSettings.Create(system), messageExtractor: new MessageExtractor(10)); Thread.Sleep(5000); Console.Write("Press ENTER to start producing messages..."); Console.ReadLine(); ProduceMessages(system, shardRegion); }
public static IActorRef StartAggregateClusterProxy( ActorSystem actorSystem, string clusterRoleName, int numberOfShards = 12) { var clusterSharding = ClusterSharding.Get(actorSystem); var shardRef = clusterSharding.StartProxy( typeof(TAggregateManager).Name, clusterRoleName, new MessageExtractor <TAggregate, TIdentity>(numberOfShards) ); return(shardRef); }
protected ClusterShardingFailureSpec() : base(new ClusterShardingFailureSpecConfig()) { _storageLocations = new[] { "akka.persistence.journal.leveldb.dir", "akka.persistence.journal.leveldb-shared.store.dir", "akka.persistence.snapshot-store.local.dir" }.Select(s => new DirectoryInfo(Sys.Settings.Config.GetString(s))).ToArray(); _region = new Lazy <IActorRef>(() => ClusterSharding.Get(Sys).ShardRegion("Entity")); _controller = new RoleName("controller"); _first = new RoleName("first"); _second = new RoleName("second"); }
static void Main(string[] args) { var config = ConfigurationFactory.ParseString(File.ReadAllText("MessageFilter.hocon")); var system = ActorSystem.Create("MessageFilterSystem", config); var shardRegion = ClusterSharding.Get(system).Start( typeName: "bucket", entityProps: Props.Create <MessageBucketController>(), settings: ClusterShardingSettings.Create(system), messageExtractor: new ShardStringMessageExtractor() ); IActorRef BucketCeo = system.ActorOf(Props.Create <MessageBucketCEOActor>(shardRegion), "BucketCEO"); List <string> randoms = new List <string>(); List <string> randoms2 = new List <string>(); for (int i = 0; i < 100; i++) { Random r = new Random(); int rInt = r.Next(0, 9); int r1Int = r.Next(0, 9); int r2Int = r.Next(0, 9); randoms.Add(string.Format("{0} {1} {2}", rInt.ToString(), r1Int.ToString(), r2Int.ToString())); } Console.ReadLine(); for (int i = 0; i < randoms.Count; i++) { BucketCeo.Tell(new StringMessage(randoms[i])); } for (int i = 0; i < 100; i++) { Random r = new Random(); int rInt = r.Next(10, 13); int r1Int = r.Next(10, 13); int r2Int = r.Next(10, 13); randoms2.Add(string.Format("{0} {1} {2}", rInt.ToString(), r1Int.ToString(), r2Int.ToString())); } Console.ReadLine(); for (int i = 0; i < randoms2.Count; i++) { BucketCeo.Tell(new StringMessage(randoms2[i])); } Console.ReadLine(); system.Terminate(); system.WhenTerminated.Wait(); }
public void Handle(DummyRequest req) { _origonalActor = Sender; var shardRegion = ClusterSharding.Get(Context.System).ShardRegion("testregion"); var message = new StreamedDataRequest(req.Size, req.NoMessages); var envelope = new Server.Envelope(1, message); shardRegion.Tell(envelope); _count = 0; _totalTimer = new Stopwatch(); _totalTimer.Start(); _log.Info("Handled DummyRequest"); }
private static void RunExample(ActorSystem system) { var proxy = ClusterSharding.Get(system).StartProxy( typeName: "customer", role: null, messageExtractor: new MessageExtractor(10000)); Thread.Sleep(2000); // Console.Write("Press enter to gen messages"); // Console.ReadLine(); //var shardRegion2 = ClusterSharding.Get(system).ShardRegion("customer"); ProduceMessages(system, proxy); //Console.ReadLine(); }
public static IActorRef StartAggregateClusterProxy(ActorSystem actorSystem, string clusterRoleName, int numberOfShards = 12) { var clusterSharding = ClusterSharding.Get(actorSystem); var shardResolver = new ShardResolvers(numberOfShards); var shardRef = clusterSharding.StartProxy( typeof(TAggregateManager).Name, clusterRoleName, ShardIdentityExtractors .AggregateIdentityExtractor <TAggregate, TIdentity>, shardResolver.AggregateShardResolver <TAggregate, TIdentity> ); return(shardRef); }
public void Start() { Logger.Info("Starting shard"); var system = ActorSystem.Create(Constants.ActorSystemName, ConfigurationFactory.Load() .WithFallback(config) .WithFallback(ClusterSingletonManager.DefaultConfig())); var sharding = ClusterSharding.Get(system); shardRegion = sharding.Start( typeName: nameof(MyActor), entityProps: Props.Create(() => new MyActor(nodeId)), settings: ClusterShardingSettings.Create(system), messageExtractor: new MessageExtractor(Constants.MaxNumberOfNodes * 10) ); ClusterClientReceptionist.Get(system).RegisterService(shardRegion); }
public static ActorSystem Start() { var system = ActorSystem.Create("system"); var cluster = Cluster.Get(system); cluster.RegisterOnMemberUp(() => { var clusterSharding = ClusterSharding.Get(system); VehicleShard = clusterSharding.StartProxy("Vehicle", Roles.Sharding, new CustomMessageExtractor()); SignalRRef = system.ActorOf <SignalRActor>("signalr"); }); System = system; system.RegisterOnTermination(() => IsInitialized = false); IsInitialized = true; return(system); }
public Persistor() { //_eventWriter = new EventWriter("Payments"); //_reader = Context.ActorOf(Props.Create<Reader>(), "eventreader"); //_automicCluster = new AutomaticCluster(Context.System); //_automicCluster.Join(); var sharding = ClusterSharding.Get(Context.System); _shardRegion = sharding.Start( typeName: "reader", entityProps: Props.Create <Reader>(), settings: ClusterShardingSettings.Create(Context.System), messageExtractor: new MessageExtractor(10)); }
static int Main(string[] args) { var config = File.ReadAllText("app.conf"); var conf = ConfigurationFactory.ParseString(config) .WithFallback(OpsConfig.GetOpsConfig()) .WithFallback(ClusterSharding.DefaultConfig()) .WithFallback(DistributedPubSub.DefaultConfig()); var actorSystem = ActorSystem.Create("AkkaTrader", conf.BootstrapFromDocker()); Cluster.Cluster.Get(actorSystem).RegisterOnMemberUp(() => { var sharding = ClusterSharding.Get(actorSystem); var shardRegionProxy = sharding.StartProxy("orderBook", "trade-processor", new StockShardMsgRouter()); foreach (var stock in AvailableTickerSymbols.Symbols) { var max = (decimal)ThreadLocalRandom.Current.Next(20, 45); var min = (decimal)ThreadLocalRandom.Current.Next(10, 15); var range = new PriceRange(min, 0.0m, max); // start bidders foreach (var i in Enumerable.Repeat(1, ThreadLocalRandom.Current.Next(1, 2))) { actorSystem.ActorOf(Props.Create(() => new BidderActor(stock, range, shardRegionProxy))); } // start askers foreach (var i in Enumerable.Repeat(1, ThreadLocalRandom.Current.Next(1, 2))) { actorSystem.ActorOf(Props.Create(() => new AskerActor(stock, range, shardRegionProxy))); } } }); // start Petabridge.Cmd (for external monitoring / supervision) var pbm = PetabridgeCmd.Get(actorSystem); pbm.RegisterCommandPalette(ClusterCommands.Instance); pbm.RegisterCommandPalette(ClusterShardingCommands.Instance); pbm.RegisterCommandPalette(RemoteCommands.Instance); pbm.Start(); actorSystem.WhenTerminated.Wait(); return(0); }
public static IActorRef StartAggregateCluster(ActorSystem actorSystem, int numberOfShards = 12) { var clusterSharding = ClusterSharding.Get(actorSystem); var clusterShardingSettings = clusterSharding.Settings; var shardResolver = new ShardResolvers(numberOfShards); var shardRef = clusterSharding.Start( typeof(TAggregateManager).Name, Props.Create <TAggregateManager>(), clusterShardingSettings, ShardIdentityExtractors .AggregateIdentityExtractor <TAggregate, TIdentity>, shardResolver.AggregateShardResolver <TAggregate, TIdentity> ); return(shardRef); }
public async Task StartAsync(CancellationToken cancellationToken) { var config = this._clusterSettings.Config.WithFallback(SystemConfig); this._system = ActorSystem.Create("NTPAC-Cluster", config); ClusterSharding.Get(this._system).Start(CaptureControllerActor.TypeName, CaptureControllerActor.Props(this._rawPacketBatchParserActorFactory), ClusterShardingSettings.Create(this._system).WithRole(CaptureControllerActor.ReassemblerClusterRoleName), new ReassemblerEntityMessageExtractor()); this._system.Scheduler.Advanced.ScheduleRepeatedly(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2), () => { this._system.Log.Info("Collecting garbage"); GC.Collect(); this._system.Log.Info("Garbage collected"); }); }
public static IActorRef StartClusteredAggregate( ActorSystem actorSystem, int numberOfShards = 12) { var clusterSharding = ClusterSharding.Get(actorSystem); var clusterShardingSettings = clusterSharding.Settings; var aggregateManagerProps = Props.Create <TAggregateManager>(); var shardRef = clusterSharding.Start( typeof(TAggregateManager).Name, Props.Create(() => new ClusterParentProxy(aggregateManagerProps, true)), clusterShardingSettings, new MessageExtractor <TAggregate, TIdentity>(numberOfShards) ); return(shardRef); }
static void Main(string[] args) { var config = ConfigurationFactory.ParseString(File.ReadAllText("Akka.conf")); // // "{app-name} - akka.tcp://{actorysystem-name}@{hostname}:{port}" // Console.Title = $"{config.GetString("akka.system.app-name")}" + $" - akka.tcp://{config.GetString("akka.system.actorsystem-name")}" + $"@{config.GetString("akka.remote.dot-netty.tcp.hostname")}" + $":{config.GetString("akka.remote.dot-netty.tcp.port")}"; ActorSystem system = ActorSystem.Create("ClusterLab", config); var cmd = PetabridgeCmd.Get(system); cmd.RegisterCommandPalette(ClusterCommands.Instance); cmd.RegisterCommandPalette(ClusterShardingCommands.Instance); cmd.Start(); Console.WriteLine(); Console.WriteLine("SeedNode1 is running..."); Console.WriteLine(); // register actor type as a sharded entity var region = ClusterSharding.Get(system).Start( typeName: "my-actor", entityProps: Props.Create <FooActor>(), settings: ClusterShardingSettings.Create(system), messageExtractor: new MessageExtractor()); Thread.Sleep(20000); // send message to entity through shard region region.Tell(new ClusterShardingShared.Envelope(shardId: 1, entityId: 1, message: new AddMessage("hello"))); region.Tell(new ClusterShardingShared.Envelope(shardId: 1, entityId: 2, message: new AddMessage("hello"))); region.Tell(new ClusterShardingShared.Envelope(shardId: 1, entityId: 3, message: new AddMessage("hello"))); region.Tell(new ClusterShardingShared.Envelope(shardId: 1, entityId: 4, message: new AddMessage("hello"))); region.Tell(new ClusterShardingShared.Envelope(shardId: 2, entityId: 1, message: new AddMessage("hello"))); region.Tell(new ClusterShardingShared.Envelope(shardId: 2, entityId: 2, message: new AddMessage("hello"))); region.Tell(new ClusterShardingShared.Envelope(shardId: 2, entityId: 3, message: new AddMessage("hello"))); Console.ReadLine(); }
public bool Start() { var config = ConfigurationLoader.Load(); ClusterSystem = ActorSystem.Create("akka-playground", config); var bookNameGuard = ClusterSystem.ActorOf(Props.Create <BookNameGuardActor>()); var clusterSharding = ClusterSharding.Get(ClusterSystem); clusterSharding.Start( typeName: nameof(BookActor), entityProps: Props.Create(() => new BookValidationActor(bookNameGuard)), settings: ClusterShardingSettings.Create(ClusterSystem).WithRole("InventoryManagement"), messageExtractor: new CustomMessageExtractor() ); return(true); }
public void ClusterSharding_should_be_easy_API_for_starting() { Within(TimeSpan.FromSeconds(50), () => { RunOn(() => { var counterRegionViaStart = ClusterSharding.Get(Sys).Start( typeName: "ApiTest", entityProps: Props.Create <Counter>(), settings: ClusterShardingSettings.Create(Sys), extractEntityId: Counter.ExtractEntityId, extractShardId: Counter.ExtractShardId); var counterRegionViaGet = ClusterSharding.Get(Sys).ShardRegion("ApiTest"); counterRegionViaStart.Should().Be(counterRegionViaGet); }, _config.First); EnterBarrier("after-11"); }); }
static void Main(string[] args) { using var sys = ActorSystem.Create("sys"); //need to spin up an identical region found in shardtest project in order for //akka to split messages between both nodes var creatorProps = Props.Create <FCInventoryAllocationActor>(); var shardExtension = ClusterSharding.Get(sys); var shardSettings = ClusterShardingSettings.Create(sys); _region = shardExtension.Start("fc", creatorProps, shardSettings, new MessageExtractor()); sys.WhenTerminated.Wait(); }
static int Main(string[] args) { var mongoConnectionString = Environment.GetEnvironmentVariable("MONGO_CONNECTION_STR")?.Trim(); if (string.IsNullOrEmpty(mongoConnectionString)) { Console.WriteLine("ERROR! MongoDb connection string not provided. Can't start."); return(-1); } else { Console.WriteLine("Connecting to MongoDb at {0}", mongoConnectionString); } var config = File.ReadAllText("app.conf"); var conf = ConfigurationFactory.ParseString(config).WithFallback(GetMongoHocon(mongoConnectionString)) .WithFallback(OpsConfig.GetOpsConfig()) .WithFallback(ClusterSharding.DefaultConfig()) .WithFallback(DistributedPubSub.DefaultConfig()); var actorSystem = ActorSystem.Create("AkkaTrader", conf.BootstrapFromDocker()); Cluster.Cluster.Get(actorSystem).RegisterOnMemberUp(() => { var sharding = ClusterSharding.Get(actorSystem); var shardRegion = sharding.Start("orderBook", s => OrderBookActor.PropsFor(s), ClusterShardingSettings.Create(actorSystem), new StockShardMsgRouter()); }); // start Petabridge.Cmd (for external monitoring / supervision) var pbm = PetabridgeCmd.Get(actorSystem); pbm.RegisterCommandPalette(ClusterCommands.Instance); pbm.RegisterCommandPalette(ClusterShardingCommands.Instance); pbm.RegisterCommandPalette(RemoteCommands.Instance); pbm.Start(); actorSystem.WhenTerminated.Wait(); return(0); }
public Chat() { Context.Become(UnInitialized); RecoverAny(UpdateState); ClusterSharding clusterSharding = ClusterSharding.Get(Context.System); _userRegion = clusterSharding.ShardRegion(typeof(User).Name); _chatView = Context.ActorOf(Props.Create(() => new ChatView())); if (_userRegion == null) { _userRegion = clusterSharding.Start( typeName: typeof(User).Name, entityProps: Props.Create <User>(), settings: ClusterShardingSettings.Create(Context.System), messageExtractor: new MessageExtractor(10)); } }
public static async Task Main(string[] args) { #region Console shutdown setup var exitEvent = new ManualResetEvent(false); Console.CancelKeyPress += (sender, eventArgs) => { eventArgs.Cancel = true; exitEvent.Set(); }; AppDomain.CurrentDomain.ProcessExit += (sender, eventArgs) => { exitEvent.Set(); }; #endregion var config = ConfigurationFactory.ParseString(await File.ReadAllTextAsync("app.conf")) .BootstrapFromDocker() .WithFallback(ClusterSingletonManager.DefaultConfig()) .WithFallback(SqlitePersistence.DefaultConfiguration()); var system = ActorSystem.Create("sharded-cluster-system", config); var sharding = ClusterSharding.Get(system); var shardRegion = await sharding.StartAsync( typeName : "customer", entityPropsFactory : e => Props.Create(() => new Customer(e)), settings : ClusterShardingSettings.Create(system), messageExtractor : new MessageExtractor(10)); var cluster = Cluster.Get(system); cluster.RegisterOnMemberUp(() => { ProduceMessages(system, shardRegion); }); exitEvent.WaitOne(); await system.Terminate(); }
private static void RunApplication(ProgramOptions opts) { Options = opts; var config = ConfigurationFactory.ParseString(File.ReadAllText("akka.hocon")); ActorSystem = ActorSystem.Create("actorSystem", config); AccountShardingActor = ClusterSharding.Get(ActorSystem).Start( "Account", Props.Create <AccountActor>(), ClusterShardingSettings.Create(ActorSystem), new MessageExtractor()); TransactionManagerActor = ClusterSharding.Get(ActorSystem).Start( "TransactionManager", Props.Create <TransactionManagerActor>(), ClusterShardingSettings.Create(ActorSystem), new MessageExtractor()); StressTest(); }
public void ClusterSharding_should_gracefully_shutdown_empty_region() { Within(TimeSpan.FromSeconds(30), () => { RunOn(() => { var allocationStrategy = new LeastShardAllocationStrategy(2, 1); var regionEmpty = ClusterSharding.Get(Sys).Start( typeName: "EntityEmpty", entityProps: Props.Create <Entity>(), settings: ClusterShardingSettings.Create(Sys), extractEntityId: extractEntityId, extractShardId: extractShardId, allocationStrategy: allocationStrategy, handOffStopMessage: StopEntity.Instance); Watch(regionEmpty); regionEmpty.Tell(GracefulShutdown.Instance); ExpectTerminated(regionEmpty, TimeSpan.FromSeconds(5)); }, _config.First); }); }
public void Should_cluster_sharding_settings_have_default_config() { ClusterSharding.Get(Sys); var config = Sys.Settings.Config.GetConfig("akka.cluster.sharding"); Assert.False(config.IsNullOrEmpty()); Assert.Equal("sharding", config.GetString("guardian-name")); Assert.Equal(string.Empty, config.GetString("role")); Assert.False(config.GetBoolean("remember-entities")); Assert.Equal(TimeSpan.FromSeconds(5), config.GetTimeSpan("coordinator-failure-backoff")); Assert.Equal(TimeSpan.FromSeconds(2), config.GetTimeSpan("retry-interval")); Assert.Equal(100000, config.GetInt("buffer-size")); Assert.Equal(TimeSpan.FromSeconds(60), config.GetTimeSpan("handoff-timeout")); Assert.Equal(TimeSpan.FromSeconds(10), config.GetTimeSpan("shard-start-timeout")); Assert.Equal(TimeSpan.FromSeconds(10), config.GetTimeSpan("entity-restart-backoff")); Assert.Equal(TimeSpan.FromSeconds(10), config.GetTimeSpan("rebalance-interval")); Assert.Equal(string.Empty, config.GetString("journal-plugin-id")); Assert.Equal(string.Empty, config.GetString("snapshot-plugin-id")); Assert.Equal("persistence", config.GetString("state-store-mode")); Assert.Equal(TimeSpan.FromSeconds(5), config.GetTimeSpan("waiting-for-state-timeout")); Assert.Equal(TimeSpan.FromSeconds(5), config.GetTimeSpan("updating-state-timeout")); Assert.Equal("akka.cluster.singleton", config.GetString("coordinator-singleton")); Assert.Equal(string.Empty, config.GetString("use-dispatcher")); Assert.Equal(1, config.GetInt("least-shard-allocation-strategy.rebalance-threshold")); Assert.Equal(3, config.GetInt("least-shard-allocation-strategy.max-simultaneous-rebalance")); Assert.Equal("all", config.GetString("entity-recovery-strategy")); Assert.Equal(TimeSpan.FromMilliseconds(100), config.GetTimeSpan("entity-recovery-constant-rate-strategy.frequency")); Assert.Equal(5, config.GetInt("entity-recovery-constant-rate-strategy.number-of-entities")); var singletonConfig = Sys.Settings.Config.GetConfig("akka.cluster.singleton"); Assert.NotNull(singletonConfig); Assert.Equal("singleton", singletonConfig.GetString("singleton-name")); Assert.Equal(string.Empty, singletonConfig.GetString("role")); Assert.Equal(TimeSpan.FromSeconds(1), singletonConfig.GetTimeSpan("hand-over-retry-interval")); Assert.Equal(15, singletonConfig.GetInt("min-number-of-hand-over-retries")); }
public void ClusterSharding_should_be_easy_API_for_starting() { ClusterSharding_should_be_easy_to_use_with_extensions(); Within(TimeSpan.FromSeconds(50), () => { RunOn(() => { var counterRegionViaStart = ClusterSharding.Get(Sys).Start( typeName: "ApiTest", entityProps: Props.Create <Counter>(), settings: ClusterShardingSettings.Create(Sys), idExtractor: Counter.ExtractEntityId, shardResolver: Counter.ExtractShardId); var counterRegionViaGet = ClusterSharding.Get(Sys).ShardRegion("ApiTest"); Assert.Equal(counterRegionViaGet, counterRegionViaStart); }, _first); EnterBarrier("after-11"); }); }
public ControlTowerActor() { // CosmosDb methods var cdb = new CosmosDB(); // get info about the flight var icao = Context.ActorOf <ICAOLookupActor>(); // register actor type as a sharded entity region = ClusterSharding.Get(Context.System).Start( typeName: "FlightActor", entityProps: Props.Create <FlightActor>(), settings: ClusterShardingSettings.Create(Context.System), messageExtractor: new MessageExtractor()); // get a set of data readings Receive <DeviceReading>(r => { foreach (var a in r.aircraft.Where(z => !string.IsNullOrWhiteSpace(z.flight))) { if (!initedActors.ContainsKey(a.flight)) { initedActors.Add(a.flight, DateTime.Now); var cos = Context.ActorOf(CosmosSaveActor.Props(cdb)); region.Tell(new ShardEnvelope(shardId: "1", entityId: a.flight, message: new FlightActor.FlightActorInit(cos, a.flight, icao))); } // create message for flight actor var req = new FlightActor.FlightDataRequest() { deviceId = r.deviceId, flightData = a, now = r.now }; // send message to entity through shard region region.Tell(new ShardEnvelope(shardId: "1", entityId: a.flight, message: req)); initedActors[a.flight] = DateTime.Now; } }); }
public CoordinatedShutdownShardingSpec(ITestOutputHelper helper) : base(SpecConfig, helper) { _sys1 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys3 = Sys; var props = Props.Create(() => new EchoActor()); _region1 = ClusterSharding.Get(_sys1).Start("type1", props, ClusterShardingSettings.Create(_sys1), _extractEntityId, _extractShard); _region2 = ClusterSharding.Get(_sys2).Start("type1", props, ClusterShardingSettings.Create(_sys2), _extractEntityId, _extractShard); _region3 = ClusterSharding.Get(_sys3).Start("type1", props, ClusterShardingSettings.Create(_sys3), _extractEntityId, _extractShard); _probe1 = CreateTestProbe(_sys1); _probe2 = CreateTestProbe(_sys2); _probe3 = CreateTestProbe(_sys3); CoordinatedShutdown.Get(_sys1).AddTask(CoordinatedShutdown.PhaseBeforeServiceUnbind, "unbind", () => { _probe1.Ref.Tell("CS-unbind-1"); return(Task.FromResult(Done.Instance)); }); CoordinatedShutdown.Get(_sys2).AddTask(CoordinatedShutdown.PhaseBeforeServiceUnbind, "unbind", () => { _probe2.Ref.Tell("CS-unbind-2"); return(Task.FromResult(Done.Instance)); }); CoordinatedShutdown.Get(_sys3).AddTask(CoordinatedShutdown.PhaseBeforeServiceUnbind, "unbind", () => { _probe3.Ref.Tell("CS-unbind-3"); return(Task.FromResult(Done.Instance)); }); }
static void Main(string[] args) { var config = args.Length > 0 ? ConfigurationFactory.ParseString(File.ReadAllText("config-lh.hocon")) : ConfigurationFactory.ParseString(File.ReadAllText("config.hocon")); var system = ActorSystem.Create("repro", config); var region = ClusterSharding .Get(system) .Start("sharded", Props.Create <MyActor>(), ClusterShardingSettings.Create(system), new MyExtractor <string>(5, system.Log)); while (Console.ReadKey().Key != ConsoleKey.Q) { for (int i = 0; i < 10; i++) { region.Tell(i.ToString()); System.Threading.Thread.Sleep(100); } } }