Interface Receptionist.Listing
-
- All Known Implementing Classes:
ReceptionistMessages.Listing
- Enclosing class:
- Receptionist
public static interface Receptionist.ListingCurrent listing of all Actors that implement the protocol given by theServiceKey.You can use
key.Listingfor type-safe pattern matching.Not for user extension.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> scala.collection.immutable.Set<ActorRef<T>>allServiceInstances(ServiceKey<T> key)Scala API: Return both the reachable and the unreachable service instances.<T> java.util.Set<ActorRef<T>>getAllServiceInstances(ServiceKey<T> key)Java API: Return both the reachable and the unreachable service instances.ServiceKey<?>getKey()Java API<T> java.util.Set<ActorRef<T>>getServiceInstances(ServiceKey<T> key)Java API: Return the reachable service instances.booleanisForKey(ServiceKey<?> key)ServiceKey<?>key()Scala API<T> scala.collection.immutable.Set<ActorRef<T>>serviceInstances(ServiceKey<T> key)Scala API: Return the reachable service instances.booleanservicesWereAddedOrRemoved()Returnstrueonly if thisListingwas sent triggered by new actors added or removed to the receptionist.
-
-
-
Method Detail
-
key
ServiceKey<?> key()
Scala API
-
getKey
ServiceKey<?> getKey()
Java API
-
isForKey
boolean isForKey(ServiceKey<?> key)
-
serviceInstances
<T> scala.collection.immutable.Set<ActorRef<T>> serviceInstances(ServiceKey<T> key)
Scala API: Return the reachable service instances.In a non-clustered
ActorSystemthis will always be all registered instances for a service key.For a clustered
ActorSystemit only contain services on nodes that are not seen as unreachable (note that they could have still have become unreachable between this message being sent and the receiving actor processing it).For a list including both reachable and unreachable instances see
allServiceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>)Also, see
ServiceKey.Listingfor more convenient pattern matching
-
getServiceInstances
<T> java.util.Set<ActorRef<T>> getServiceInstances(ServiceKey<T> key)
Java API: Return the reachable service instances.In a non-clustered
ActorSystemthis will always be all registered instances for a service key.For a clustered
ActorSystemit only contain services on nodes that has are not seen as unreachable (note that they could have still have become unreachable between this message being sent and the receiving actor processing it).For a list including both reachable and unreachable instances see
getAllServiceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>)
-
allServiceInstances
<T> scala.collection.immutable.Set<ActorRef<T>> allServiceInstances(ServiceKey<T> key)
Scala API: Return both the reachable and the unreachable service instances.In a non-clustered
ActorSystemthis will always be the same asserviceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>).For a clustered
ActorSystemthis include both services on nodes that are reachable and nodes that are unreachable.
-
getAllServiceInstances
<T> java.util.Set<ActorRef<T>> getAllServiceInstances(ServiceKey<T> key)
Java API: Return both the reachable and the unreachable service instances.In a non-clustered
ActorSystemthis will always be the same asgetServiceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>).For a clustered
ActorSystemthis include both services on nodes that are reachable and nodes that are unreachable.
-
servicesWereAddedOrRemoved
boolean servicesWereAddedOrRemoved()
Returnstrueonly if thisListingwas sent triggered by new actors added or removed to the receptionist. Whenfalsethe event is only about reachability changes - meaning that the full set of actors (allServiceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>)orgetAllServiceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>)) is the same as the previousListing.knowing this is useful for subscribers only concerned with
allServiceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>)orgetAllServiceInstances(org.apache.pekko.actor.typed.receptionist.ServiceKey<T>)that can then ignoreListings related to reachability.In a non-clustered
ActorSystemthis will betruefor all listings. ForFindqueries and the initial listing for aSubscribethis will always betrue.
-
-