I have an interesting issue with AKKA.NET making 'SampleActor' to singleton in 'CustomCluster'. No exceptions or warnings are thrown. During debugging on I am unable to get SampleActor initialized as cluster singleton, even in unit tests, I am able to get the ActorRef to this actor with full path no problems, but the actor seems not to be initializing (Constructor and other "OnStart" type of functions are not being hit. I have tried "telling" messages directly to actor that in ordinary way it was used (like 'OrdinaryActor' in cluster) it was recieving those messages and working well. Sending messages thru proxy with full actor ref path is not working and I am sure it is because actor is not being initialized.
What am I missing at this point? There is full configuration for akka.cluster.singleton
and I have tried with many different ways.
private static ActorSystem _actorSystem;
....
_actorSystem = ActorSystem.Create("CustomCluster", systemSetup);
var me = ServiceProvider.GetService<IActorRef>();
_actorSystem.ActorOf(
Props.Create(() => new OrdinaryActor(me)),
nameof(OrdinaryActor)); //Joins Cluster no problems
ClusterSingletonManagerSettings settings =
ClusterSingletonManagerSettings.Create( _actorSystem ).WithRole("worker");
_actorSystem.ActorOf( ClusterSingletonManager.Props(
Props.Create( () => new SampleActor(me)),
PoisonPill.Instance, settings ), "SampleActorSingleton" );
ClusterSingletonProxySettings proxySettings =
ClusterSingletonProxySettings.Create( _actorSystem ).WithRole( "worker" );
_actorSystem.ActorOf( ClusterSingletonProxy.Props( "/user/SampleActorSingleton", proxySettings ), "SampleActorSingletonProxy");
//Initialization of 'SampleActor is not being hit, no exceptions, I am able to get Actor ref but it is not functional'