Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Akka.Net clustered hash group router confusion
<akka>
<hocon>
<![CDATA[
{
"akka": {
"actor": {
"deployment": {
"/MyClusteredActor": {
"cluster": {
"allow-local-routees": "off",
"enabled": "on",
"max-nr-of-instances-per-node": 1,
"use-role": "sampleserver"
},
"nr-of-instances": 3,
"routees": {
"paths": [
"/user/MyClusteredActor"
]
},
"router": "consistent-hashing-group"
}
},
"provider": "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
},
"cluster": {
"roles": [
"sampleclient"
],
"seed-nodes": [
"akka.tcp://mycluster@127.0.0.1:4053"
]
},
"loggers": [
"Akka.Logger.Serilog.SerilogLogger,Akka.Logger.Serilog"
],
"loglevel": "DEBUG",
"remote": {
"helios": {
"tcp": {
"hostname": "127.0.0.1",
"port": 9001
}
},
"log-remote-lifecycle-events": "DEBUG"
}
}
}
]]>
</hocon>
</akka>
ActorSystem Sys = ActorSystem.Create("ILServiceCluster");
//read from hocon in app.config so we can create IActorRef to send messages to based on hash group routing
var actorRef = Sys.ActorOf(
Props.Empty.WithRouter(FromConfig.Instance), "MyClusteredActor");
<akka>
<hocon>
<![CDATA[
{
"akka": {
"actor": {
"provider": "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
},
"cluster": {
"roles": [
"sampleserver"
],
"seed-nodes": [
"akka.tcp://mycluster@127.0.0.1:4053"
]
},
"loggers": [
"Akka.Logger.Serilog.SerilogLogger,Akka.Logger.Serilog"
],
"loglevel": "DEBUG",
"remote": {
"helios": {
"tcp": {
"hostname": "127.0.0.1",
"port": 9000
}
},
"log-remote-lifecycle-events": "DEBUG"
}
}
}
]]>
</hocon>
</akka>
ActorSystem Sys = ActorSystem.Create("ILServiceCluster");
//does this cause a clash or weird behavior because it creates the "MyClusteredActor" already in the server node
//when the client comes along and defines a 'deployment' for the actor at the /user/MyClusteredActor route?
//does the clustering capability know it already exists a that path and leave it alone?
//also, what happens if another 'client' spins up somewhere else with the same 'deployment' config?
var actorRef = Sys.ActorOf(Props.Create<MyClusteredActor>(), "MyClusteredActor");
@4deeptech

This comment has been minimized.

Copy link
Owner Author

4deeptech commented Dec 20, 2016

See questions in the servernode.cs file comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.