In Java, the singleton actor in the system is initialized using the following construct:
ClusterSingleton singleton = ClusterSingleton.get(system);
ActorRef<Counter.Command> proxy =
singleton.init(SingletonActor.of(Counter.create(), "GlobalCounter"));
Is there a way to pass a custom configuration to select custom mailbox and dispatcher ?
Typically the custom mailbox (and also dispatcher) is set in the config and the actor behavior is spawned using the config selector:
my-app {
my-special-mailbox {
mailbox-type = "akka.dispatch.SingleConsumerOnlyUnboundedMailbox"
}
}
context.spawn(
childBehavior,
"from-config-mailbox-child",
MailboxSelector.fromConfig("my-app.my-special-mailbox"));
context.spawn(
behavior, "DispatcherFromConfig", DispatcherSelector.fromConfig("your-dispatcher"));