From 45328b96b4f98581d3efd1a66c8cee1a96e50a8b Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Sat, 5 Nov 2016 16:16:53 -0700 Subject: [PATCH] fixed cluster sharding demo --- .../PersistenceBenchmark.csproj | 2 +- src/examples/Chat/ChatClient/Program.cs | 12 +++++++----- src/examples/Chat/ChatServer/Program.cs | 3 --- .../ClusterSharding.Node/App.config | 4 ++-- .../AutomaticJoin/AutomaticCluster.cs | 5 +++-- .../ClusterSharding.Node.csproj | 5 ++++- .../ClusterSharding.Node/store.db | Bin 0 -> 2048 bytes .../ClusterToolsExample.Node.csproj | 2 +- .../ClusterToolsExample.Seed.csproj | 2 +- .../ClusterToolsExample.Shared.csproj | 2 +- .../Samples.Cluster.Transformation/Program.cs | 1 + .../Cluster/Samples.Cluster.Simple/Program.cs | 2 +- 12 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 src/examples/Cluster/ClusterSharding/ClusterSharding.Node/store.db diff --git a/src/benchmark/PersistenceBenchmark/PersistenceBenchmark.csproj b/src/benchmark/PersistenceBenchmark/PersistenceBenchmark.csproj index 88ef8fa9bff..4fae2254217 100644 --- a/src/benchmark/PersistenceBenchmark/PersistenceBenchmark.csproj +++ b/src/benchmark/PersistenceBenchmark/PersistenceBenchmark.csproj @@ -42,7 +42,7 @@ ..\..\packages\Google.ProtocolBuffersLite.2.4.1.555\lib\net40\Google.ProtocolBuffersLite.Serialization.dll True - + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True diff --git a/src/examples/Chat/ChatClient/Program.cs b/src/examples/Chat/ChatClient/Program.cs index c1602f51c4d..f52a472316d 100644 --- a/src/examples/Chat/ChatClient/Program.cs +++ b/src/examples/Chat/ChatClient/Program.cs @@ -24,9 +24,6 @@ static void Main(string[] args) } remote { helios.tcp { - transport-class = ""Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"" - applied-adapters = [] - transport-protocol = tcp port = 0 hostname = localhost } @@ -37,7 +34,6 @@ static void Main(string[] args) using (var system = ActorSystem.Create("MyClient", config)) { var chatClient = system.ActorOf(Props.Create()); - system.ActorSelection("akka.tcp://MyServer@localhost:8081/user/ChatServer"); chatClient.Tell(new ConnectRequest() { Username = "Roggan", @@ -110,6 +106,7 @@ public void Handle(SayResponse message) public void Handle(ConnectRequest message) { Console.WriteLine("Connecting...."); + Context.Watch(_server); _server.Tell(message); } @@ -117,7 +114,12 @@ public void Handle(SayRequest message) { message.Username = this._nick; _server.Tell(message); - } + } + + public void Handle(Terminated message) + { + Console.Write("Server died"); + } } } diff --git a/src/examples/Chat/ChatServer/Program.cs b/src/examples/Chat/ChatServer/Program.cs index 2d77e4516b0..efde6d84bbe 100644 --- a/src/examples/Chat/ChatServer/Program.cs +++ b/src/examples/Chat/ChatServer/Program.cs @@ -24,9 +24,6 @@ static void Main(string[] args) } remote { helios.tcp { - transport-class = ""Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"" - applied-adapters = [] - transport-protocol = tcp port = 8081 hostname = 0.0.0.0 public-hostname = localhost diff --git a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/App.config b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/App.config index 3ad56124738..d8650c14cce 100644 --- a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/App.config +++ b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/App.config @@ -33,14 +33,14 @@ journal { plugin = "akka.persistence.journal.sqlite" sqlite { - connection-string = "Data Source=.\\store.db;Version=3;" + connection-string = "Data Source=.\\store.db" auto-initialize = true } } snapshot-store { plugin = "akka.persistence.snapshot-store.sqlite" sqlite { - connection-string = "Data Source=.\\store.db;Version=3;" + connection-string = "Data Source=.\\store.db" auto-initialize = true } } diff --git a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/AutomaticJoin/AutomaticCluster.cs b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/AutomaticJoin/AutomaticCluster.cs index 993f72d6a43..9728a2ddbd6 100644 --- a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/AutomaticJoin/AutomaticCluster.cs +++ b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/AutomaticJoin/AutomaticCluster.cs @@ -26,12 +26,13 @@ public class AutomaticCluster public AutomaticCluster(ActorSystem system) { - _system = system; + _system = system; _cluster = Cluster.Get(system); _persistence = SqlitePersistence.Get(system); _dbHelper = new DbHelper(() => { - var conn = new SQLiteConnection(_persistence.DefaultJournalConfig.GetString("connection-string")); + var str = _system.Settings.Config.GetString("akka.persistence.journal.sqlite.connection-string"); + var conn = new SQLiteConnection(str); conn.Open(); return conn; }); diff --git a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj index 23d13cc8bc1..4ad2e5a012e 100644 --- a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj +++ b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj @@ -46,7 +46,7 @@ ..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll True - + ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True @@ -86,6 +86,9 @@ Designer + + PreserveNewest + diff --git a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/store.db b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/store.db new file mode 100644 index 0000000000000000000000000000000000000000..7fd3e295fbcb942a99c87cc71b1d8547ce20b893 GIT binary patch literal 2048 zcmWFz^vNtqRY=P(%1ta$FlJz3U}R))P*7lCU|>SRj8HZUkcI(}7$LyKp!;zLFGv+o zC-W9U%17l#Ltr!n2!((bBb&IaEMsO#Vp2|OUVcexZb3;UjAn8Ua&-)GRS0o(@^Mvw ri7IGhrYL0Qm87Pp7AX`IW#%RpRVrksR%#NmYgB$T1V%$(_=W%g#-SoE literal 0 HcmV?d00001 diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj index a0e09825810..372e6590cdd 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj @@ -44,7 +44,7 @@ ..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll True - + ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj index 4f4b1dd628f..283f8c6a555 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj @@ -44,7 +44,7 @@ ..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll True - + ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj index c0488c22795..16bf30d3358 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj @@ -42,7 +42,7 @@ ..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll True - + ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True diff --git a/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Program.cs b/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Program.cs index 82db89a98e7..9289deaa47e 100644 --- a/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Program.cs +++ b/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Program.cs @@ -26,6 +26,7 @@ static void Main(string[] args) LaunchBackend(new[] { "2552" }); LaunchBackend(new string[0]); LaunchFrontend(new string[0]); + LaunchFrontend(new string[0]); //starting 2 frontend nodes and 3 backend nodes Console.WriteLine("Press any key to exit."); Console.ReadKey(); diff --git a/src/examples/Cluster/Samples.Cluster.Simple/Program.cs b/src/examples/Cluster/Samples.Cluster.Simple/Program.cs index c1555c65cfe..78c66faffb6 100644 --- a/src/examples/Cluster/Samples.Cluster.Simple/Program.cs +++ b/src/examples/Cluster/Samples.Cluster.Simple/Program.cs @@ -19,7 +19,7 @@ private static void Main(string[] args) { StartUp(args.Length == 0 ? new String[] { "2551", "2552", "0" } : args); Console.WriteLine("Press any key to exit"); - Console.ReadKey(); + Console.ReadLine(); } public static void StartUp(string[] ports)