Skip to content

Commit

Permalink
fixed cluster sharding demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Nov 5, 2016
1 parent 0f97ba0 commit 45328b9
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<HintPath>..\..\packages\Google.ProtocolBuffersLite.2.4.1.555\lib\net40\Google.ProtocolBuffersLite.Serialization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
Expand Down
12 changes: 7 additions & 5 deletions src/examples/Chat/ChatClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -37,7 +34,6 @@ static void Main(string[] args)
using (var system = ActorSystem.Create("MyClient", config))
{
var chatClient = system.ActorOf(Props.Create<ChatClientActor>());
system.ActorSelection("akka.tcp://MyServer@localhost:8081/user/ChatServer");
chatClient.Tell(new ConnectRequest()
{
Username = "Roggan",
Expand Down Expand Up @@ -110,14 +106,20 @@ public void Handle(SayResponse message)
public void Handle(ConnectRequest message)
{
Console.WriteLine("Connecting....");
Context.Watch(_server);
_server.Tell(message);
}

public void Handle(SayRequest message)
{
message.Username = this._nick;
_server.Tell(message);
}
}

public void Handle(Terminated message)
{
Console.Write("Server died");
}
}
}

3 changes: 0 additions & 3 deletions src/examples/Chat/ChatServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<HintPath>..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
Expand Down Expand Up @@ -86,6 +86,9 @@
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="store.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\contrib\cluster\Akka.Cluster.Sharding\Akka.Cluster.Sharding.csproj">
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<HintPath>..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<HintPath>..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<HintPath>..\..\..\..\packages\Helios.2.1.2\lib\net45\Helios.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/examples/Cluster/Samples.Cluster.Simple/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 45328b9

Please sign in to comment.