diff --git a/src/Akka.sln b/src/Akka.sln index 1f934f7b038..76ff9971bc7 100644 --- a/src/Akka.sln +++ b/src/Akka.sln @@ -279,6 +279,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Persistence.Query.InMe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Persistence.Query.InMemory.Tests", "contrib\persistence\Akka.Persistence.Query.InMemory.Tests\Akka.Persistence.Query.InMemory.Tests.csproj", "{407DD6E2-F274-4773-BA5E-43541D5C8D0F}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{7735F35A-E7B7-44DE-B6FB-C770B53EB69C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClusterToolsExample.Shared", "examples\Cluster\ClusterTools\ClusterToolsExample.Shared\ClusterToolsExample.Shared.csproj", "{88D7D845-2F50-4D37-9026-B0A8353D0E8D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClusterToolsExample.Seed", "examples\Cluster\ClusterTools\ClusterToolsExample.Seed\ClusterToolsExample.Seed.csproj", "{ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClusterToolsExample.Node", "examples\Cluster\ClusterTools\ClusterToolsExample.Node\ClusterToolsExample.Node.csproj", "{337A85B5-4A7C-4883-8634-46E7E52A765F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1298,6 +1306,42 @@ Global {407DD6E2-F274-4773-BA5E-43541D5C8D0F}.Release|x64.Build.0 = Release|Any CPU {407DD6E2-F274-4773-BA5E-43541D5C8D0F}.Release|x86.ActiveCfg = Release|Any CPU {407DD6E2-F274-4773-BA5E-43541D5C8D0F}.Release|x86.Build.0 = Release|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Debug|x64.ActiveCfg = Debug|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Debug|x64.Build.0 = Debug|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Debug|x86.ActiveCfg = Debug|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Debug|x86.Build.0 = Debug|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Release|Any CPU.Build.0 = Release|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Release|x64.ActiveCfg = Release|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Release|x64.Build.0 = Release|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Release|x86.ActiveCfg = Release|Any CPU + {88D7D845-2F50-4D37-9026-B0A8353D0E8D}.Release|x86.Build.0 = Release|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Debug|x64.Build.0 = Debug|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Debug|x86.ActiveCfg = Debug|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Debug|x86.Build.0 = Debug|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Release|Any CPU.Build.0 = Release|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Release|x64.ActiveCfg = Release|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Release|x64.Build.0 = Release|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Release|x86.ActiveCfg = Release|Any CPU + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8}.Release|x86.Build.0 = Release|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Debug|x64.ActiveCfg = Debug|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Debug|x64.Build.0 = Debug|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Debug|x86.ActiveCfg = Debug|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Debug|x86.Build.0 = Debug|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Release|Any CPU.Build.0 = Release|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Release|x64.ActiveCfg = Release|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Release|x64.Build.0 = Release|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Release|x86.ActiveCfg = Release|Any CPU + {337A85B5-4A7C-4883-8634-46E7E52A765F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1420,6 +1464,10 @@ Global {4022147A-4F95-4A04-BE09-01B7952BBDD9} = {A640E39E-F45C-4AE9-AABF-7F1432D357DA} {A310BC3F-065A-4D0D-BC6A-9E444E96F10F} = {264C22A4-CAFC-41F6-B82C-4DDC5C196767} {407DD6E2-F274-4773-BA5E-43541D5C8D0F} = {264C22A4-CAFC-41F6-B82C-4DDC5C196767} + {7735F35A-E7B7-44DE-B6FB-C770B53EB69C} = {C50E1A9E-820C-4E75-AE39-6F96A99AC4A7} + {88D7D845-2F50-4D37-9026-B0A8353D0E8D} = {7735F35A-E7B7-44DE-B6FB-C770B53EB69C} + {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8} = {7735F35A-E7B7-44DE-B6FB-C770B53EB69C} + {337A85B5-4A7C-4883-8634-46E7E52A765F} = {7735F35A-E7B7-44DE-B6FB-C770B53EB69C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {03AD8E21-7507-4E68-A4E9-F4A7E7273164} diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/App.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/App.config deleted file mode 100644 index 14ec7a5d5f5..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/App.config +++ /dev/null @@ -1,67 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj index adddd25c6bf..d44189b004e 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj @@ -1,234 +1,22 @@ - - - + + - Debug - AnyCPU - {337A85B5-4A7C-4883-8634-46E7E52A765F} Exe - Properties - ClusterToolsExample.Node - ClusterToolsExample.Node - v4.5 - 512 + $(NetTestVersion) - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll - True - - - ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - - ..\..\..\..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True - - - - - - - - - + - - + + + - - + + - - {5cf8a8be-b634-473f-bb01-eba878746bd4} - Akka.Cluster.Tools - - - {b47ca568-40cf-48de-b87e-31bd400ebb08} - Akka.Serialization.Wire - - - {6ab00f61-269a-4501-b06a-026707f000a7} - Akka.Cluster - - - {ea4ff8fd-7c53-49c8-b9aa-02e458b3e6a7} - Akka.Remote - - - {5deddf90-37f0-48d3-a0b0-a5cbd8a7e377} - Akka - - - {88d7d845-2f50-4d37-9026-b0a8353d0e8d} - ClusterToolsExample.Shared - + + Always + - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net35\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net35\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net20\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net20\Google.ProtocolBuffers.dll - True - True - - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl30\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl30\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl40\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl40\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\portable-net40+sl4+sl5+wp7+wp8+win8\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\portable-net40+sl4+sl5+wp7+wp8+win8\Google.ProtocolBuffers.dll - True - True - - - - - - - - - ..\..\..\..\..\packages\Helios\lib\net40\Helios.NET40.dll - True - True - - - - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll - True - True - - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll - True - True - - - - - - - \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/Program.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/Program.cs index 7cea4406209..56e2a942baa 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/Program.cs +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/Program.cs @@ -6,58 +6,59 @@ //----------------------------------------------------------------------- using System; +using System.IO; +using System.Threading.Tasks; using Akka.Actor; using Akka.Cluster.Tools.Client; using Akka.Cluster.Tools.Singleton; using ClusterToolsExample.Shared; -namespace ClusterToolsExample.Node +namespace ClusterToolsExample.Node; + +public static class Program { - class Program + public static async Task Main(string[] args) { - static void Main(string[] args) - { - Console.Title = "Attached node"; - using (var system = ActorSystem.Create("singleton-cluster-system")) - { - //RunClusterSingletonClient(system); - RunDistributedPubSubClient(system); - //RunClusterClient(system); + Console.Title = "Attached node"; + var config = await File.ReadAllTextAsync("akka.conf"); + using var system = ActorSystem.Create("singleton-cluster-system", config); + + //RunClusterSingletonClient(system); + RunDistributedPubSubClient(system); + //RunClusterClient(system); - Console.ReadLine(); - } - } + Console.ReadLine(); + } - /// - /// Creates a proxy to communicate with cluster singleton initialized by the seed. - /// - static void RunClusterSingletonClient(ActorSystem system) - { - var proxyRef = system.ActorOf(ClusterSingletonProxy.Props( + /// + /// Creates a proxy to communicate with cluster singleton initialized by the seed. + /// + private static void RunClusterSingletonClient(ActorSystem system) + { + var proxyRef = system.ActorOf(ClusterSingletonProxy.Props( singletonManagerPath: "/user/manager", settings: ClusterSingletonProxySettings.Create(system).WithRole("worker")), - name: "managerProxy"); - } + name: "managerProxy"); + } - /// - /// Creates an actor which subscribes to the distributed pub/sub topic. - /// This topic is filled with messages from the cluster seed job. - /// - static void RunDistributedPubSubClient(ActorSystem system) - { - var echo = system.ActorOf(Props.Create(() => new EchoReceiver())); - echo.Tell(new object()); - } + /// + /// Creates an actor which subscribes to the distributed pub/sub topic. + /// This topic is filled with messages from the cluster seed job. + /// + private static void RunDistributedPubSubClient(ActorSystem system) + { + var echo = system.ActorOf(Props.Create(() => new EchoReceiver())); + echo.Tell(new object()); + } - /// - /// Creates a cluster client, that allows to connect to cluster even thou current actor system is not part of it. - /// - static void RunClusterClient(ActorSystem system) - { - //NOTE: to properly run cluster client set up actor ref provider for nodes on `provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"` - system.Settings.InjectTopLevelFallback(ClusterClientReceptionist.DefaultConfig()); - var clusterClient = system.ActorOf(ClusterClient.Props(ClusterClientSettings.Create(system))); - clusterClient.Tell(new ClusterClient.Send("/user/my-service", new Echo("hello from cluster client"))); - } + /// + /// Creates a cluster client, that allows to connect to cluster even though current actor system is not part of it. + /// + private static void RunClusterClient(ActorSystem system) + { + //NOTE: to properly run cluster client set up actor ref provider for nodes on `provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"` + system.Settings.InjectTopLevelFallback(ClusterClientReceptionist.DefaultConfig()); + var clusterClient = system.ActorOf(ClusterClient.Props(ClusterClientSettings.Create(system))); + clusterClient.Tell(new ClusterClient.Send("/user/my-service", new Echo("hello from cluster client"))); } -} +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/Properties/AssemblyInfo.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/Properties/AssemblyInfo.cs deleted file mode 100644 index 7018c7336e5..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2023 Lightbend Inc. -// Copyright (C) 2013-2023 .NET Foundation -// -//----------------------------------------------------------------------- - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ClusterToolsExample.Node")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ClusterToolsExample.Node")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("337a85b5-4a7c-4883-8634-46e7e52a765f")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/akka.conf b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/akka.conf new file mode 100644 index 00000000000..377e0856ecc --- /dev/null +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/akka.conf @@ -0,0 +1,48 @@ +akka +{ + stdout-loglevel = DEBUG + loglevel = INFO + + actor + { + provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster" + serializers + { + hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion" + } + serialization-bindings + { + "System.Object" = hyperion + } + } + + remote + { + log-remote-lifecycle-events = off + dot-netty.tcp + { + hostname = "127.0.0.1" + port = 0 + } + } + + cluster + { + roles = [] + seed-nodes = ["akka.tcp://singleton-cluster-system@127.0.0.1:12551"] + auto-down-unreachable-after = 10s + + singleton-proxy + { + singleton-name = "manager" + role = "" + singleton-identification-interval = 1s + buffer-size = 100 + } + + client + { + initial-contacts = ["akka.tcp://singleton-cluster-system@127.0.0.1:2551/system/receptionist"] + } + } +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/packages.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/packages.config deleted file mode 100644 index 06cc1b70c28..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/App.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/App.config deleted file mode 100644 index 52aed7dcfaa..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/App.config +++ /dev/null @@ -1,61 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj index 7e029b603ef..393b1243bb9 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj @@ -1,236 +1,19 @@ - - - + + - Debug - AnyCPU - {ED00E6F4-2B5C-4F16-ADE4-45E4A73C17B8} Exe - Properties - ClusterToolsExample.Seed - ClusterToolsExample.Seed - v4.5 - 512 + $(NetTestVersion) - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll - True - - - ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - - ..\..\..\..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True - - - - - - - - - + - - + + + - - - Designer + + Always - - - {5cf8a8be-b634-473f-bb01-eba878746bd4} - Akka.Cluster.Tools - - - {b47ca568-40cf-48de-b87e-31bd400ebb08} - Akka.Serialization.Wire - - - {6ab00f61-269a-4501-b06a-026707f000a7} - Akka.Cluster - - - {ea4ff8fd-7c53-49c8-b9aa-02e458b3e6a7} - Akka.Remote - - - {5deddf90-37f0-48d3-a0b0-a5cbd8a7e377} - Akka - - - {88d7d845-2f50-4d37-9026-b0a8353d0e8d} - ClusterToolsExample.Shared - - - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net35\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net35\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net20\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net20\Google.ProtocolBuffers.dll - True - True - - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl30\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl30\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl40\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl40\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\portable-net40+sl4+sl5+wp7+wp8+win8\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\portable-net40+sl4+sl5+wp7+wp8+win8\Google.ProtocolBuffers.dll - True - True - - - - - - - - - ..\..\..\..\..\packages\Helios\lib\net40\Helios.NET40.dll - True - True - - - - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll - True - True - - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll - True - True - - - - - - - + \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/Program.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/Program.cs index b0b8ac1e6f2..bd6084f4764 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/Program.cs +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/Program.cs @@ -6,61 +6,63 @@ //----------------------------------------------------------------------- using System; +using System.IO; +using System.Threading.Tasks; using Akka.Actor; +using Akka.Cluster; using Akka.Cluster.Tools.Client; using Akka.Cluster.Tools.PublishSubscribe; using Akka.Cluster.Tools.Singleton; using ClusterToolsExample.Shared; -namespace ClusterToolsExample.Seed +namespace ClusterToolsExample.Seed; + +public static class Program { - class Program + public static async Task Main(string[] args) { - static void Main(string[] args) - { - Console.Title = "Seed node"; - using (var system = ActorSystem.Create("singleton-cluster-system")) - { - //RunClusterSingletonSeed(system); - RunDistributedPubSubSeed(system); - //RunClusterClientSeed(system); + Console.Title = "Seed node"; + var config = await File.ReadAllTextAsync("akka.conf"); + using var system = ActorSystem.Create("singleton-cluster-system", config); + + //RunClusterSingletonSeed(system); + RunDistributedPubSubSeed(system); + //RunClusterClientSeed(system); - Console.ReadLine(); - } - } + Console.ReadLine(); + } - /// - /// Initializes cluster singleton of the actor. - /// - /// - static void RunClusterSingletonSeed(ActorSystem system) - { - var aref = system.ActorOf(ClusterSingletonManager.Props( + /// + /// Initializes cluster singleton of the actor. + /// + /// + private static void RunClusterSingletonSeed(ActorSystem system) + { + var aref = system.ActorOf(ClusterSingletonManager.Props( singletonProps: Props.Create(() => new WorkerManager()), terminationMessage: PoisonPill.Instance, settings: ClusterSingletonManagerSettings.Create(system)), - name: "manager"); - } + name: "manager"); + } - /// - /// Starts a job, which publishes message to distributed cluster pub sub in 5 sec periods. - /// - static void RunDistributedPubSubSeed(ActorSystem system) - { - var mediator = DistributedPubSub.Get(system).Mediator; + /// + /// Starts a job, which publishes message to distributed cluster pub sub in 5 sec periods. + /// + private static void RunDistributedPubSubSeed(ActorSystem system) + { + var mediator = DistributedPubSub.Get(system).Mediator; - system.Scheduler.ScheduleTellRepeatedly(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), mediator, - new Publish("echo", new Echo("hello world")), ActorRefs.NoSender); - } + system.Scheduler.ScheduleTellRepeatedly(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), mediator, + new Publish("echo", new Echo("hello world")), ActorRefs.NoSender); + } - /// - /// Starts a job, which establishes cluster client receptionist for target actor, - /// making it visible from outside of the cluster. - /// - static void RunClusterClientSeed(ActorSystem system) - { - var receptionist = ClusterClientReceptionist.Get(system); - receptionist.RegisterService(system.ActorOf(Props.Create(), "my-service")); - } + /// + /// Starts a job, which establishes cluster client receptionist for target actor, + /// making it visible from outside of the cluster. + /// + private static void RunClusterClientSeed(ActorSystem system) + { + var receptionist = ClusterClientReceptionist.Get(system); + receptionist.RegisterService(system.ActorOf(Props.Create(), "my-service")); } -} +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/Properties/AssemblyInfo.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/Properties/AssemblyInfo.cs deleted file mode 100644 index 3dde164be1d..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2023 Lightbend Inc. -// Copyright (C) 2013-2023 .NET Foundation -// -//----------------------------------------------------------------------- - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ClusterToolsExample.Seed")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ClusterToolsExample.Seed")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ed00e6f4-2b5c-4f16-ade4-45e4a73c17b8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/akka.conf b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/akka.conf new file mode 100644 index 00000000000..9ca846e47af --- /dev/null +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/akka.conf @@ -0,0 +1,42 @@ +akka +{ + stdout-loglevel = DEBUG + loglevel = INFO + + actor + { + provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster" + serializers + { + hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion" + } + serialization-bindings + { + "System.Object" = hyperion + } + } + + remote + { + log-remote-lifecycle-events = off + dot-netty.tcp + { + hostname = "127.0.0.1" + port = 12551 + } + } + + cluster + { + roles = ["seed"] + seed-nodes = ["akka.tcp://singleton-cluster-system@127.0.0.1:12551"] + auto-down-unreachable-after = 10s + + singleton + { + singleton-name = "manager" + role = "" + hand-over-retry-interval = 1s + } + } +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/packages.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/packages.config deleted file mode 100644 index 06cc1b70c28..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj index 9f83318b595..344f37bbd21 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj @@ -1,229 +1,11 @@ - - - + + - Debug - AnyCPU - {88D7D845-2F50-4D37-9026-B0A8353D0E8D} - Library - Properties - ClusterToolsExample.Shared - ClusterToolsExample.Shared - v4.5 - 512 + $(NetTestVersion) - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll - True - - - ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True - - - - ..\..\..\..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True - - - - - - - - - - - - - - - - - - - - Designer - - + - - {5cf8a8be-b634-473f-bb01-eba878746bd4} - Akka.Cluster.Tools - - - {6ab00f61-269a-4501-b06a-026707f000a7} - Akka.Cluster - - - {ea4ff8fd-7c53-49c8-b9aa-02e458b3e6a7} - Akka.Remote - - - {5deddf90-37f0-48d3-a0b0-a5cbd8a7e377} - Akka - + - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net35\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net35\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net20\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\net20\Google.ProtocolBuffers.dll - True - True - - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl30\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl30\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl40\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\sl40\Google.ProtocolBuffers.dll - True - True - - - - - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\portable-net40+sl4+sl5+wp7+wp8+win8\Google.ProtocolBuffers.Serialization.dll - True - True - - - ..\..\..\..\..\packages\Google.ProtocolBuffers\lib\portable-net40+sl4+sl5+wp7+wp8+win8\Google.ProtocolBuffers.dll - True - True - - - - - - - - - ..\..\..\..\..\packages\Helios\lib\net40\Helios.NET40.dll - True - True - - - - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll - True - True - - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\..\..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll - True - True - - - - - - - + \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Echo.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Echo.cs index 8cb4cb724df..4e3aa5f3e4b 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Echo.cs +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Echo.cs @@ -10,42 +10,41 @@ using Akka.Cluster; using Akka.Cluster.Tools.PublishSubscribe; -namespace ClusterToolsExample.Shared +namespace ClusterToolsExample.Shared; + +public sealed class Echo +{ + public readonly string Message; + + public Echo(string message) + { + Message = message; + } +} + +public class EchoReceiver : ReceiveActor { - public sealed class Echo + private const string Topic = "echo"; + + private readonly Cluster _cluster = Cluster.Get(Context.System); + private readonly IActorRef _mediator = DistributedPubSub.Get(Context.System).Mediator; + + public EchoReceiver() { - public readonly string Message; + Receive(echo => Console.WriteLine(echo.Message)); + Receive(ack => + Console.WriteLine("Actor [{0}] has subscribed to topic [{1}]", ack.Subscribe.Ref, ack.Subscribe.Topic)); + } - public Echo(string message) - { - Message = message; - } + protected override void PreStart() + { + base.PreStart(); + _mediator.Tell(new Subscribe(Topic, Self)); } - public class EchoReceiver : ReceiveActor + protected override void PostStop() { - public const string Topic = "echo"; - - public readonly Cluster Cluster = Cluster.Get(Context.System); - public readonly IActorRef Mediator = DistributedPubSub.Get(Context.System).Mediator; - - public EchoReceiver() - { - Receive(echo => Console.WriteLine(echo.Message)); - Receive(ack => - Console.WriteLine("Actor [{0}] has subscribed to topic [{1}]", ack.Subscribe.Ref, ack.Subscribe.Topic)); - } - - protected override void PreStart() - { - base.PreStart(); - Mediator.Tell(new Subscribe(Topic, Self)); - } - - protected override void PostStop() - { - Mediator.Tell(new Unsubscribe(Topic, Self)); - base.PostStop(); - } + _mediator.Tell(new Unsubscribe(Topic, Self)); + base.PostStop(); } -} +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Messages.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Messages.cs index fa53476091b..2c1848bcb29 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Messages.cs +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Messages.cs @@ -9,59 +9,58 @@ using System.Collections.Generic; using Akka.Actor; -namespace ClusterToolsExample.Shared +namespace ClusterToolsExample.Shared; + +[Serializable] +public sealed class Batch { - [Serializable] - public sealed class Batch - { - public readonly int Size; + public readonly int Size; - public Batch(int size) - { - Size = size; - } + public Batch(int size) + { + Size = size; } +} - [Serializable] - public sealed class Work - { - public readonly int Id; +[Serializable] +public sealed class Work +{ + public readonly int Id; - public Work(int id) - { - Id = id; - } + public Work(int id) + { + Id = id; } +} - [Serializable] - public sealed class Result - { - public readonly int Id; +[Serializable] +public sealed class Result +{ + public readonly int Id; - public Result(int id) - { - Id = id; - } + public Result(int id) + { + Id = id; } +} - [Serializable] - public sealed class SendReport - { - public static readonly SendReport Instance = new SendReport(); +[Serializable] +public sealed class SendReport +{ + public static readonly SendReport Instance = new (); - private SendReport() - { - } + private SendReport() + { } +} - [Serializable] - public sealed class Report - { - public readonly IDictionary Counts; +[Serializable] +public sealed class Report +{ + public readonly IDictionary Counts; - public Report(IDictionary counts) - { - Counts = counts; - } + public Report(IDictionary counts) + { + Counts = counts; } -} +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Properties/AssemblyInfo.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Properties/AssemblyInfo.cs deleted file mode 100644 index c5ac7738346..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2023 Lightbend Inc. -// Copyright (C) 2013-2023 .NET Foundation -// -//----------------------------------------------------------------------- - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ClusterToolsExample.Shared")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ClusterToolsExample.Shared")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("88d7d845-2f50-4d37-9026-b0a8353d0e8d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkLoadCounter.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkLoadCounter.cs index 2e01b5000a3..1727102be46 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkLoadCounter.cs +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkLoadCounter.cs @@ -9,25 +9,22 @@ using Akka.Actor; using Akka.Event; -namespace ClusterToolsExample.Shared +namespace ClusterToolsExample.Shared; + +public class WorkLoadCounter : ReceiveActor { - public class WorkLoadCounter : ReceiveActor + public WorkLoadCounter() { - public WorkLoadCounter() - { - var log = Context.GetLogger(); - var counts = new Dictionary(); + var counts = new Dictionary(); - Receive(_ => - { - int count; - if (counts.TryGetValue(Sender, out count)) - counts[Sender] = (++count); - else - counts.Add(Sender, 1); - }); + Receive(_ => + { + if (counts.TryGetValue(Sender, out var count)) + counts[Sender] = ++count; + else + counts.Add(Sender, 1); + }); - Receive(_ => Sender.Tell(new Report(counts))); - } + Receive(_ => Sender.Tell(new Report(counts))); } -} +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Worker.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Worker.cs index be766f21287..63403fd0972 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Worker.cs +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/Worker.cs @@ -8,21 +8,20 @@ using Akka.Actor; using Akka.Event; -namespace ClusterToolsExample.Shared +namespace ClusterToolsExample.Shared; + +public class Worker : ReceiveActor { - public class Worker : ReceiveActor + public Worker(IActorRef counter) { - public Worker(IActorRef counter) - { - var log = Context.GetLogger(); + var log = Context.GetLogger(); - Receive(work => - { - var result = new Result(work.Id); - log.Info("Worker {0} - result: {1}", Self.Path.Name, result.Id); - Sender.Tell(result); - counter.Tell(result); - }); - } + Receive(work => + { + var result = new Result(work.Id); + log.Info("Worker {0} - result: {1}", Self.Path.Name, result.Id); + Sender.Tell(result); + counter.Tell(result); + }); } -} +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkerManager.cs b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkerManager.cs index 12941000b1f..a0964200920 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkerManager.cs +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/WorkerManager.cs @@ -11,53 +11,63 @@ using Akka.Event; using Akka.Routing; -namespace ClusterToolsExample.Shared +namespace ClusterToolsExample.Shared; + +public class WorkerManager : ReceiveActor, IWithTimers { - public class WorkerManager : ReceiveActor + private const string BatchKey = nameof(BatchKey); + private const string ReportKey = nameof(ReportKey); + + private readonly Random _random = new(); + + public WorkerManager() { - private readonly Random random = new Random(); - public WorkerManager() + var log = Context.GetLogger(); + var counter = Context.ActorOf(name: "workload-counter"); + var workerRouter = GetWorkerRouter(counter); + + Receive(batch => { - var log = Context.GetLogger(); - var counter = Context.ActorOf(name: "workload-counter"); - var workerRouter = GetWorkerRouter(counter); + log.Info("Generating a batch of size {0}", batch.Size); + for (var i = 0; i < batch.Size; i++) + workerRouter.Tell(new Work(i)); + + Timers.StartSingleTimer(BatchKey, GetBatch(), TimeSpan.FromSeconds(10)); + }); - Receive(batch => + Receive(report => + { + foreach (var (actor, count) in report.Counts) { - log.Info("Generating a batch of size {0}", batch.Size); - for (int i = 0; i < batch.Size; i++) - workerRouter.Tell(new Work(i)); + var name = (string.IsNullOrEmpty(actor.Path.Address.Host) + ? "local/" + : actor.Path.Address.Host + ":" + actor.Path.Address.Port + "/") + actor.Path.Name; - Context.System.Scheduler.ScheduleTellOnce(TimeSpan.FromSeconds(10), Self, GetBatch(), Self); - }); + log.Info("{0} -> {1}", name, count); + } + }); - Receive(report => - { - foreach (var entry in report.Counts) - { - var key = entry.Key; - var value = entry.Value; - var name = (string.IsNullOrEmpty(key.Path.Address.Host) ? "local/" : key.Path.Address.Host + ":" + key.Path.Address.Port + "/") + key.Path.Name; + Receive(msg => + { + counter.Tell(msg); + }); - log.Info("{0} -> {1}", name, value); - } - }); + Timers.StartSingleTimer(BatchKey, GetBatch(), TimeSpan.FromSeconds(3)); + Timers.StartPeriodicTimer(ReportKey, SendReport.Instance, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10)); + } - Context.System.Scheduler.ScheduleTellOnce(TimeSpan.FromSeconds(3), Self, GetBatch(), Self); - Context.System.Scheduler.ScheduleTellRepeatedly(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10), counter, SendReport.Instance, Self); - } + public ITimerScheduler Timers { get; set; } - private IActorRef GetWorkerRouter(IActorRef counter) - { - return Context.ActorOf(new ClusterRouterPool( + private IActorRef GetWorkerRouter(IActorRef counter) + { + return Context.ActorOf(new ClusterRouterPool( local: new RoundRobinPool(10), settings: new ClusterRouterPoolSettings(30, 10, true, null)) - .Props(Props.Create(() => new Worker(counter)))); - } + .Props(Props.Create(() => new Worker(counter)))); + } - private Batch GetBatch() - { - return new Batch(random.Next(5) + 5); - } + private Batch GetBatch() + { + return new Batch(_random.Next(5) + 5); } -} +} \ No newline at end of file diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/packages.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/packages.config deleted file mode 100644 index 06cc1b70c28..00000000000 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file