public void Start()
        {
            lighthouseSystem = LighthouseHostFactory.LaunchLighthouse();
            PetabridgeCmd pbm = PetabridgeCmd.Get(lighthouseSystem);

            pbm.RegisterCommandPalette(ClusterCommands.Instance); // enable cluster management commands
            pbm.Start();
        }
Exemplo n.º 2
0
        private static void StartActorSystem()
        {
            Config clusterConfig = ConfigurationFactory.ParseString(@"
                petabridge.cmd{
	                                        host = ""0.0.0.0""
	                                        port = 9111
                                        }
				akka {
                    log-config-on-start = on 
					actor {
						provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
                        ask-timeout = 60s
                        debug {
			                        receive = on
			                        autoreceive = on
			                        lifecycle = on
			                        event-stream = on
			                        unhandled = on
		                        }
                        deployment {
                                    /SecondRouter {
				                    router = round-robin-group
				                    routees.paths = [""/user/SecondRouter""]
				                    cluster {
					                    enabled = on
					                    allow-local-routees = off
					                    use-role = SecondRouter
				                        }
			                        }
			                       /FirstRouter/FirstActor {
				                    router = round-robin-pool
				                    resizer {
					                    enabled = on
					                    lower-bound = 5
					                    upper-bound = 10
					                    pressure-threshold = 1
					                    rampup-rate = 0.2
					                    backoff-threshold = 0.3
					                    backoff-rate = 0.1
					                    messages-per-resize = 5
				                    }
                                }
                        }
                    }
					remote {
						maximum-payload-bytes = 83886080 bytes
		                dot-netty.tcp {
			                hostname = ""127.0.0.1""
			                port = 9112
                            connection-timeout = 15 s
                            send-buffer-size = 256000b
                            receive-buffer-size = 256000b
			                maximum-frame-size = 83886080b
                            backlog = 4096
		                }
					}
					cluster {
						seed-nodes = [""akka.tcp://[email protected]:4053""]
                        roles = [""FirstRouter""]
                    }
				}
            ");

            _actorSystem = ActorSystem.Create("myactorsystem", clusterConfig);

            _akkaHealthCheck = AkkaHealthCheck.For(_actorSystem);

            // create pbm host
            PetabridgeCmd cmd = PetabridgeCmd.Get(_actorSystem);

            cmd.RegisterCommandPalette(ClusterCommands.Instance);
            cmd.RegisterCommandPalette(RemoteCommands.Instance);
            cmd.Start();

            SecondRouterActor = _actorSystem.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), "SecondRouter");
            RouterActor       = _actorSystem.ActorOf(Props.Create <RouterActor>(SecondRouterActor), "FirstRouter");

            //Wait for actor system to be initialize
            Thread.Sleep(6000);
            for (int i = 0; i < 10; i++)
            {
                var result = (User)(RouterActor.Ask(new GetUserMessage(i)).Result);
                Console.WriteLine($"Name: {result.Name} - Surname: {result.Surname} - UserId: {result.UserId} - UserGroupId: {result.UserGroup.UserGroupId} - UserGroupName: {result.UserGroup.UserGroupName}");
            }
        }
Exemplo n.º 3
0
        private static void StartActorSystem()
        {
            Config clusterConfig = ConfigurationFactory.ParseString(@"
                petabridge.cmd{
	                                        host = ""0.0.0.0""
	                                        port = 9113
                                        }
				akka {
                log-config-on-start = on
					actor {
						provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
                        ask-timeout = 60s
                        debug {
			                receive = on
			                autoreceive = on
			                lifecycle = on
			                event-stream = on
			                unhandled = on
		                }
                        deployment {
			                       /SecondRouter/SecondActor {
				                    router = round-robin-pool
				                    resizer {
					                    enabled = on
					                    lower-bound = 5
					                    upper-bound = 10
					                    pressure-threshold = 1
					                    rampup-rate = 0.2
					                    backoff-threshold = 0.3
					                    backoff-rate = 0.1
					                    messages-per-resize = 5
				                    }
                                }
                        }
                    }
					remote {
						maximum-payload-bytes = 83886080 bytes
		                dot-netty.tcp {
			                hostname = ""127.0.0.1""
			                port = 9114
                            connection-timeout = 15 s
                            send-buffer-size = 256000b
                            receive-buffer-size = 256000b
			                maximum-frame-size = 83886080b
                            backlog = 4096
		                }
					}
					cluster {
						seed-nodes = [""akka.tcp://[email protected]:4053""]
                        roles = [""SecondRouter""]
                    }
				}
            ");

            _actorSystem = ActorSystem.Create("myactorsystem", clusterConfig);

            _akkaHealthCheck = AkkaHealthCheck.For(_actorSystem);

            // create pbm host
            PetabridgeCmd cmd = PetabridgeCmd.Get(_actorSystem);

            cmd.RegisterCommandPalette(ClusterCommands.Instance);
            cmd.RegisterCommandPalette(RemoteCommands.Instance);
            cmd.Start();

            RouterActor = _actorSystem.ActorOf(Props.Create <RouterActor>(), "SecondRouter");
        }