Class Receptionist
- java.lang.Object
-
- org.apache.pekko.actor.typed.receptionist.Receptionist
-
- All Implemented Interfaces:
Extension
public abstract class Receptionist extends java.lang.Object implements Extension
Register and discover actors that implement a service with a protocol defined by aServiceKey.This class is not intended for user extension other than for test purposes (e.g. stub implementation). More methods may be added in the future and that may break such implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReceptionist.CommandThe set of commands accepted by a Receptionist.static classReceptionist.Deregister$Remove association between the givenpekko.actor.typed.ActorRefand the givenServiceKey.static interfaceReceptionist.DeregisteredConfirmation that the givenpekko.actor.typed.ActorRefno more associated with theServiceKeyin the local receptionist.static classReceptionist.Deregistered$Sent by the receptionist, available here for easier testingstatic classReceptionist.Find$Findmessage.static interfaceReceptionist.ListingCurrent listing of all Actors that implement the protocol given by theServiceKey.static classReceptionist.Listing$Sent by the receptionist, available here for easier testingstatic classReceptionist.Register$Registermessage.static interfaceReceptionist.RegisteredConfirmation that the givenpekko.actor.typed.ActorRefhas been associated with theServiceKey.static classReceptionist.Registered$Sent by the receptionist, available here for easier testingstatic classReceptionist.Subscribe$Subscribemessage.
-
Constructor Summary
Constructors Constructor Description Receptionist()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Tapply(ActorSystem<?> system)static ReceptionistcreateExtension(ActorSystem<?> system)static <T> Receptionist.Commandderegister(ServiceKey<T> key, ActorRef<T> service)Java API: A Deregister message without Ack that the service was unregisteredstatic <T> Receptionist.Commandderegister(ServiceKey<T> key, ActorRef<T> service, ActorRef<Receptionist.Deregistered> replyTo)Java API: A Deregister message with an actor that will get an ack that the service was unregisteredstatic <T> Receptionist.Deregisteredderegistered(ServiceKey<T> key, ActorRef<T> serviceInstance)Java API: Sent by the receptionist, available here for easier testingstatic booleanequals(java.lang.Object other)static <T> Receptionist.Commandfind(ServiceKey<T> key, ActorRef<Receptionist.Listing> replyTo)Java API:Findmessage.static Receptionistget(ActorSystem<?> system)static inthashCode()static ExtensionId<T>id()static <T> Receptionist.Listinglisting(ServiceKey<T> key, java.util.Set<ActorRef<T>> serviceInstances)Java API: Sent by the receptionist, available here for easier testingstatic <T> Receptionist.Listinglisting(ServiceKey<T> key, java.util.Set<ActorRef<T>> serviceInstances, java.util.Set<ActorRef<T>> allServiceInstances, boolean servicesWereAddedOrRemoved)Java API: Sent by the receptionist, available here for easier testingabstract ActorRef<Receptionist.Command>ref()static <T> Receptionist.Commandregister(ServiceKey<T> key, ActorRef<T> service)Java API: A Register message without Ack that the service was registered.static <T> Receptionist.Commandregister(ServiceKey<T> key, ActorRef<T> service, ActorRef<Receptionist.Registered> replyTo)Java API: ARegistermessage with Ack that the service was registered.static <T> Receptionist.Registeredregistered(ServiceKey<T> key, ActorRef<T> serviceInstance)Java API: Sent by the receptionist, available here for easier testingstatic <T> Receptionist.Commandsubscribe(ServiceKey<T> key, ActorRef<Receptionist.Listing> subscriber)Java API:Subscribemessage.
-
-
-
Method Detail
-
createExtension
public static Receptionist createExtension(ActorSystem<?> system)
-
get
public static Receptionist get(ActorSystem<?> system)
-
register
public static <T> Receptionist.Command register(ServiceKey<T> key, ActorRef<T> service)
Java API: A Register message without Ack that the service was registered. Associate the givenpekko.actor.typed.ActorRefwith the givenServiceKeyby sending this command to theReceptionist.ref.Multiple registrations can be made for the same key. De-registration is implied by the end of the referenced Actor’s lifecycle, but it can also be explicitly deregistered before termination.
-
register
public static <T> Receptionist.Command register(ServiceKey<T> key, ActorRef<T> service, ActorRef<Receptionist.Registered> replyTo)
Java API: ARegistermessage with Ack that the service was registered. Associate the givenpekko.actor.typed.ActorRefwith the givenServiceKeyby sending this command to theReceptionist.ref.Multiple registrations can be made for the same key. De-registration is implied by the end of the referenced Actor’s lifecycle, but it can also be explicitly deregistered before termination.
Registration will be acknowledged with the
Receptionist.Registeredmessage to the given replyTo actor.
-
registered
public static <T> Receptionist.Registered registered(ServiceKey<T> key, ActorRef<T> serviceInstance)
Java API: Sent by the receptionist, available here for easier testing
-
deregister
public static <T> Receptionist.Command deregister(ServiceKey<T> key, ActorRef<T> service)
Java API: A Deregister message without Ack that the service was unregistered
-
deregister
public static <T> Receptionist.Command deregister(ServiceKey<T> key, ActorRef<T> service, ActorRef<Receptionist.Deregistered> replyTo)
Java API: A Deregister message with an actor that will get an ack that the service was unregistered
-
deregistered
public static <T> Receptionist.Deregistered deregistered(ServiceKey<T> key, ActorRef<T> serviceInstance)
Java API: Sent by the receptionist, available here for easier testing
-
subscribe
public static <T> Receptionist.Command subscribe(ServiceKey<T> key, ActorRef<Receptionist.Listing> subscriber)
Java API:Subscribemessage. The given actor to service updates when this command is sent to theReceptionist.ref. When the set of instances registered for the given key changes the subscriber will be sent aReceptionist.Listingwith the new set of instances for that service.The subscription will be acknowledged by sending out a first
Receptionist.Listing. The subscription automatically ends with the termination of the subscriber.
-
find
public static <T> Receptionist.Command find(ServiceKey<T> key, ActorRef<Receptionist.Listing> replyTo)
Java API:Findmessage. Query the Receptionist for a list of all Actors implementing the given protocol at one point in time by sending this command to theReceptionist.ref.
-
listing
public static <T> Receptionist.Listing listing(ServiceKey<T> key, java.util.Set<ActorRef<T>> serviceInstances)
Java API: Sent by the receptionist, available here for easier testing
-
listing
public static <T> Receptionist.Listing listing(ServiceKey<T> key, java.util.Set<ActorRef<T>> serviceInstances, java.util.Set<ActorRef<T>> allServiceInstances, boolean servicesWereAddedOrRemoved)
Java API: Sent by the receptionist, available here for easier testing
-
apply
public static final T apply(ActorSystem<?> system)
-
hashCode
public static final int hashCode()
-
equals
public static final boolean equals(java.lang.Object other)
-
id
public static ExtensionId<T> id()
-
ref
public abstract ActorRef<Receptionist.Command> ref()
-
-