Class Props

java.lang.Object
org.apache.pekko.actor.Props
All Implemented Interfaces:
Serializable, scala.Equals, scala.Product

public final class Props extends Object implements scala.Product, Serializable
See Also:
  • Constructor Details

    • Props

      public Props(Deploy deploy, Class<?> clazz, scala.collection.immutable.Seq<Object> args)
  • Method Details

    • defaultCreator

      public static final scala.Function0<Actor> defaultCreator()
      The defaultCreator, simply throws an UnsupportedOperationException when applied, which is used when creating a Props
    • defaultRoutedProps

      public static final RouterConfig defaultRoutedProps()
      The defaultRoutedProps is NoRouter which is used when creating a Props
    • defaultDeploy

      public static final Deploy defaultDeploy()
      The default Deploy instance which is used when creating a Props
    • empty

      public static final Props empty()
      A Props instance whose creator will create an actor that doesn't respond to any message
    • apply

      public static <T extends Actor> Props apply(scala.reflect.ClassTag<T> evidence$1)
      Scala API: Returns a Props that has default values except for "creator" which will be a function that creates an instance of the supplied type using the default constructor.
    • apply

      public static <T extends Actor> Props apply(scala.Function0<T> creator, scala.reflect.ClassTag<T> evidence$2)
      Scala API: Returns a Props that has default values except for "creator" which will be a function that creates an instance using the supplied thunk.

      CAVEAT: Required mailbox type cannot be detected when using anonymous mixin composition when creating the instance. For example, the following will not detect the need for DequeBasedMessageQueueSemantics as defined in Stash:

      
       'Props(new Actor with Stash { ... })
       
      Instead you must create a named class that mixin the trait, e.g. class MyActor extends Actor with Stash.
    • apply

      public static Props apply(Class<?> clazz, scala.collection.immutable.Seq<Object> args)
      Scala API: create a Props given a class and its constructor arguments.
    • apply

      public static Props apply(Deploy deploy, Class<?> clazz, scala.collection.immutable.Seq<Object> args)
      Props is a configuration object using in creating an Actor; it is immutable, so it is thread-safe and fully shareable.

      Examples on Scala API:

      
        val props = Props.empty
        val props = Props[MyActor]
        val props = Props(classOf[MyActor], arg1, arg2)
      
        val otherProps = props.withDispatcher("dispatcher-id")
        val otherProps = props.withDeploy(<deployment info>)
       

      Examples on Java API:

      
        final Props props = Props.empty();
        final Props props = Props.create(MyActor.class, arg1, arg2);
      
        final Props otherProps = props.withDispatcher("dispatcher-id");
        final Props otherProps = props.withDeploy(<deployment info>);
       
    • unapply

      public static scala.Option<scala.Tuple3<Deploy,Class<?>,scala.collection.immutable.Seq<Object>>> unapply(Props x$0)
    • create

      public static Props create(Class<?> clazz, scala.collection.immutable.Seq<Object> args)
    • create

      public static <T extends Actor> Props create(Class<T> actorClass, Creator<T> creator)
    • create

      public static Props create(Class<?> clazz, Object... args)
    • withActorTags

      public Props withActorTags(String... tags)
      Returns a new Props with the specified set of tags.
    • deploy

      public Deploy deploy()
    • clazz

      public Class<?> clazz()
    • args

      public scala.collection.immutable.Seq<Object> args()
    • dispatcher

      public String dispatcher()
      Convenience method for extracting the dispatcher information from the contained Deploy instance.
    • mailbox

      public String mailbox()
      Convenience method for extracting the mailbox information from the contained Deploy instance.
    • routerConfig

      public RouterConfig routerConfig()
      Convenience method for extracting the router configuration from the contained Deploy instance.
    • withDispatcher

      public Props withDispatcher(String d)
      Returns a new Props with the specified dispatcher set.
    • withMailbox

      public Props withMailbox(String m)
      Returns a new Props with the specified mailbox set.
    • withRouter

      public Props withRouter(RouterConfig r)
      Returns a new Props with the specified router config set.
    • withDeploy

      public Props withDeploy(Deploy d)
      Returns a new Props with the specified deployment configuration.
    • withActorTags

      public Props withActorTags(scala.collection.immutable.Seq<String> tags)
      Returns a new Props with the specified set of tags.
    • withActorTags

      public Props withActorTags(scala.collection.immutable.Set<String> tags)
      Scala API: Returns a new Props with the specified set of tags.
    • actorClass

      public Class<? extends Actor> actorClass()
      Obtain an upper-bound approximation of the actor class which is going to be created by these Props. In other words, the actor factory method will produce an instance of this class or a subclass thereof. This is used by the actor system to select special dispatchers or mailboxes in case dependencies are encoded in the actor type.
    • copy

      public Props copy(Deploy deploy, Class<?> clazz, scala.collection.immutable.Seq<Object> args)
    • copy$default$1

      public Deploy copy$default$1()
    • copy$default$2

      public Class<?> copy$default$2()
    • copy$default$3

      public scala.collection.immutable.Seq<Object> copy$default$3()
    • productPrefix

      public String productPrefix()
      Specified by:
      productPrefix in interface scala.Product
    • productArity

      public int productArity()
      Specified by:
      productArity in interface scala.Product
    • productElement

      public Object productElement(int x$1)
      Specified by:
      productElement in interface scala.Product
    • productIterator

      public scala.collection.Iterator<Object> productIterator()
      Specified by:
      productIterator in interface scala.Product
    • canEqual

      public boolean canEqual(Object x$1)
      Specified by:
      canEqual in interface scala.Equals
    • productElementName

      public String productElementName(int x$1)
      Specified by:
      productElementName in interface scala.Product
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object x$1)
      Specified by:
      equals in interface scala.Equals
      Overrides:
      equals in class Object