public static async Task Start(string port, string seqPort) { const string clusterName = "test"; var log = LoggerFactory.Create(x => x.AddSeq($"http://localhost:{seqPort}").SetMinimumLevel(LogLevel.Debug)); Log.SetLoggerFactory(log); Console.WriteLine("Starting worker"); var system = new ActorSystem(); var serialization = new Serialization(); var cluster = new Cluster(system, serialization); var grains = new Grains(cluster); serialization.RegisterFileDescriptor(ProtosReflection.Descriptor); grains.HelloGrainFactory(() => new HelloGrain()); await cluster.Start( clusterName, "127.0.0.1", int.Parse(port), new ConsulProvider(new ConsulProviderOptions { DeregisterCritical = TimeSpan.FromSeconds(2) }) ); Console.WriteLine("Started worked on " + system.ProcessRegistry.Address); Console.ReadLine(); await cluster.Shutdown(); }
static async Task Main(string[] args) { var system = new ActorSystem(); var remoteConfig = GrpcCoreRemoteConfig .BindToLocalhost(12000) .WithProtoMessages(ProtosReflection.Descriptor); var consulProvider = new ConsulProvider(new ConsulProviderConfig(), c => c.Address = new Uri("http://consul:8500/")); var clusterConfig = ClusterConfig.Setup("MyCluster", consulProvider, new PartitionIdentityLookup()); system .WithRemote(remoteConfig) .WithCluster(clusterConfig); var grains = new Grains(system.Cluster()); grains.HelloGrainFactory(() => new HelloGrain()); await system.Cluster().StartMemberAsync(); Console.CancelKeyPress += async(e, y) => { Console.WriteLine("Shutting Down..."); await system.Cluster().ShutdownAsync(); }; await Task.Delay(-1); }
static void Main(string[] args) { Serialization.RegisterFileDescriptor(ProtosReflection.Descriptor); Grains.HelloGrainFactory(() => new HelloGrain()); Cluster.Start("MyCluster", "127.0.0.1", 12000, new ConsulProvider(new ConsulProviderOptions())); Console.ReadLine(); }
public static void Start(string clusterName) { // Console.WriteLine("Starting worker"); Serialization.RegisterFileDescriptor(ProtosReflection.Descriptor); Grains.HelloGrainFactory(() => new HelloGrain()); Cluster.Start(clusterName, "127.0.0.1", 0, new ConsulProvider(new ConsulProviderOptions())); Console.ReadLine(); }
private static void Main(string[] args) { Serialization.RegisterFileDescriptor(ProtosReflection.Descriptor); Grains.HelloGrainFactory(() => new HelloGrain()); Cluster.Start("BorisNodeTest", "127.0.0.1", 12000, new ConsulProvider(new ConsulProviderOptions(), c => c.Address = new Uri("http://127.0.0.1:8500/"))); Thread.Sleep(System.Threading.Timeout.Infinite); Console.WriteLine("Shutting Down..."); Cluster.Shutdown(); }
static async Task Main(string[] args) { var system = new ActorSystem(); var serialization = new Serialization(); var cluster = new Cluster(system, serialization); var grains = new Grains(cluster); serialization.RegisterFileDescriptor(ProtosReflection.Descriptor); grains.HelloGrainFactory(() => new HelloGrain()); await cluster.Start("MyCluster", "node2", 12000, new ConsulProvider(new ConsulProviderOptions(), c => c.Address = new Uri("http://consul:8500/"))); Console.CancelKeyPress += async(e, y) => { Console.WriteLine("Shutting Down..."); await cluster.Shutdown(); }; await Task.Delay(-1); }