Class Receptionist
- java.lang.Object
-
- akka.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 class
Receptionist.Command
The set of commands accepted by a Receptionist.static class
Receptionist.Deregister$
Remove association between the givenActorRef
and the givenServiceKey
.static interface
Receptionist.Deregistered
Confirmation that the givenActorRef
no more associated with theServiceKey
in the local receptionist.static class
Receptionist.Deregistered$
Sent by the receptionist, available here for easier testingstatic class
Receptionist.Find$
Find
message.static interface
Receptionist.Listing
Current listing of all Actors that implement the protocol given by theServiceKey
.static class
Receptionist.Listing$
Sent by the receptionist, available here for easier testingstatic class
Receptionist.Register$
Register
message.static interface
Receptionist.Registered
Confirmation that the givenActorRef
has been associated with theServiceKey
.static class
Receptionist.Registered$
Sent by the receptionist, available here for easier testingstatic class
Receptionist.Subscribe$
Subscribe
message.
-
Constructor Summary
Constructors Constructor Description Receptionist()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static T
apply(ActorSystem<?> system)
static Receptionist
createExtension(ActorSystem<?> system)
static <T> Receptionist.Command
deregister(ServiceKey<T> key, ActorRef<T> service)
Java API: A Deregister message without Ack that the service was unregisteredstatic <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 unregisteredstatic <T> Receptionist.Deregistered
deregistered(ServiceKey<T> key, ActorRef<T> serviceInstance)
Java API: Sent by the receptionist, available here for easier testingstatic boolean
equals(java.lang.Object other)
static <T> Receptionist.Command
find(ServiceKey<T> key, ActorRef<Receptionist.Listing> replyTo)
Java API:Find
message.static Receptionist
get(ActorSystem<?> system)
static int
hashCode()
static ExtensionId<T>
id()
static <T> Receptionist.Listing
listing(ServiceKey<T> key, java.util.Set<ActorRef<T>> serviceInstances)
Java API: Sent by the receptionist, available here for easier testingstatic <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 testingabstract ActorRef<Receptionist.Command>
ref()
static <T> Receptionist.Command
register(ServiceKey<T> key, ActorRef<T> service)
Java API: A Register message without Ack that the service was registered.static <T> Receptionist.Command
register(ServiceKey<T> key, ActorRef<T> service, ActorRef<Receptionist.Registered> replyTo)
Java API: ARegister
message with Ack that the service was registered.static <T> Receptionist.Registered
registered(ServiceKey<T> key, ActorRef<T> serviceInstance)
Java API: Sent by the receptionist, available here for easier testingstatic <T> Receptionist.Command
subscribe(ServiceKey<T> key, ActorRef<Receptionist.Listing> subscriber)
Java API:Subscribe
message.
-
-
-
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 givenActorRef
with the givenServiceKey
by 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: ARegister
message with Ack that the service was registered. Associate the givenActorRef
with the givenServiceKey
by 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.Registered
message 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:Subscribe
message. 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.Listing
with 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:Find
message. 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()
-
-