SingletonCluster Actor not getting intialized properly (Unable to send messages / register with receptionist)


I’m creating a cluster singleton actor, but

  1. the actor doesn’t seem to be getting created ?
  2. when i try to register it with the receptionist, it doesn’t get
  3. when i try to send a message to it - it doesn’t get
    sent (meaning, when i do a .tell(msg) on this actor, the handling behavior does not get triggered)

Here is what my actor class looks like

public class QueryExecutorActor extends AbstractBehavior<QueryExecutorActor.Command> {
    public static ServiceKey<Command> key = ServiceKey.create(Command.class, "QueryExecutor"); 

private final Config config;
private QueryExecutorActor(ActorContext<Command> context, Config config) {
  this.config = config;
  context.getSystem().receptionist().tell(Receptionist.register(key, context.getSelf()));"created")

public static Behavior<Command> create(Config config) {
  return Behaviors.setup(context -> new QueryExecutorActor(context, config));

As you can see, I am telling the receptionist to register this actor, and also printing a log statement - neither of which takes place when the create() function is called.

ClusterSingleton singleton = ClusterSingleton.get(system)

ActorRef<QueryExecutor.Command> queryExecutorRef = singleton.init(SingletonActor.of(QueryExecutor.create(config),;"Started on", queryExecutorRef.path()); // prints akka://app/system/singletonProxyQueryExecutor-no-dc

Here, it “looks” like the actor is created, since i am able to get its path - but how come none of that stuff in the constructor gets ever logged or register itself with the receptionist ?

Did you join the cluster?

1 Like

Hi, your suspicion was correct.

I had not joined the cluster. I was trying to run the program as a single cluster, but didn’t do it the correct way.