Class SingletonActor<M>

java.lang.Object
org.apache.pekko.cluster.typed.SingletonActor<M>

public final class SingletonActor<M> extends Object
  • Constructor Details

    • SingletonActor

      public SingletonActor()
  • Method Details

    • apply

      public static <M> SingletonActor<M> apply(Behavior<M> behavior, String name)
      Parameters:
      name - Unique name for the singleton
      behavior - Behavior for the singleton
    • of

      public static <M> SingletonActor<M> of(Behavior<M> behavior, String name)
      Java API

      Parameters:
      name - Unique name for the singleton
      behavior - Behavior for the singleton
    • behavior

      public Behavior<M> behavior()
    • name

      public String name()
    • props

      public Props props()
    • stopMessage

      public scala.Option<M> stopMessage()
    • settings

      public scala.Option<ClusterSingletonSettings> settings()
    • withProps

      public SingletonActor<M> withProps(Props props)
      pekko.actor.typed.Props of the singleton actor, such as dispatcher settings.
    • withStopMessage

      public SingletonActor<M> withStopMessage(M msg)
      Message sent to the singleton to tell it to stop, e.g. when being migrated. If this is not defined it will be stopped automatically. It can be useful to define a custom stop message if the singleton needs to perform some asynchronous cleanup or interactions before stopping.
    • withSettings

      public SingletonActor<M> withSettings(ClusterSingletonSettings settings)
      Additional settings, typically loaded from configuration.