Example #1
0
        public void Start()
        {
            var actorSystemName = "akka-cluster";
            var hoconConfig     = ConfigurationFactory.ParseString(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "application.conf"));

            var config = hoconConfig.GetConfig("cluster-management");

            if (config != null)
            {
                actorSystemName = config.GetString("actorsystem", actorSystemName);
            }

            actorSystem = ActorSystem.Create(actorSystemName, hoconConfig);

            Cluster.Get(actorSystem).RegisterOnMemberUp(() =>
            {
                ClusterSharding.Get(actorSystem).Start(
                    typeName: "my-actor",
                    entityProps: Props.Create <MyActor>(),
                    settings: ClusterShardingSettings.Create(actorSystem),
                    messageExtractor: new MessageExtractor());
            });

            // Akka Management hosts the HTTP routes used by bootstrap
            ClusterHttpManagement.Get(actorSystem).Start();
        }
Example #2
0
        public void Start()
        {
            var str    = "cluster-management-system";
            var config = ((AkkaConfigurationSection)ConfigurationManager.GetSection("akka")).AkkaConfig.GetConfig("cluster-management");

            if (config != null)
            {
                str = config.GetString("actorsystem", str);
            }
            system = ActorSystem.Create(str);
            ClusterHttpManagement.Get(system).Start();

            Console.WriteLine("Press Enter to exit...");
            Console.ReadLine();
        }
Example #3
0
 public void Stop()
 {
     ClusterHttpManagement.Get(actorSystem).Stop();
     CoordinatedShutdown.Get(actorSystem).Run(CoordinatedShutdown.ClrExitReason.Instance).Wait();
 }
Example #4
0
 public void Stop()
 {
     ClusterHttpManagement.Get(system).Stop();
     system.Terminate();
 }