public class ShardRegion extends java.lang.Object implements Actor, ActorLogging
ShardRegion
actor on other nodes.
ClusterSharding extension
Modifier and Type | Class and Description |
---|---|
static class |
ShardRegion.ClusterShardingStats
Reply to
ShardRegion.GetClusterShardingStats , contains statistics about all the sharding regions
in the cluster. |
static class |
ShardRegion.ClusterShardingStats$ |
static class |
ShardRegion.CurrentRegions
Reply to
GetCurrentRegions |
static class |
ShardRegion.CurrentRegions$ |
static class |
ShardRegion.CurrentShardRegionState
Reply to
ShardRegion.GetShardRegionState$ |
static class |
ShardRegion.CurrentShardRegionState$ |
static class |
ShardRegion.GetClusterShardingStats
Send this message to the
ShardRegion actor to request for ShardRegion.ClusterShardingStats ,
which contains statistics about the currently running sharded entities in the
entire cluster. |
static class |
ShardRegion.GetClusterShardingStats$ |
static class |
ShardRegion.GetCurrentRegions$
Send this message to the
ShardRegion actor to request for ShardRegion.CurrentRegions ,
which contains the addresses of all registered regions. |
static class |
ShardRegion.GetShardRegionState$
Send this message to a
ShardRegion actor instance to request a
ShardRegion.CurrentShardRegionState which describes the current state of the region. |
static class |
ShardRegion.GetShardRegionStats$
Send this message to the
ShardRegion actor to request for ShardRegion.ShardRegionStats ,
which contains statistics about the currently running sharded entities in the
entire region. |
static class |
ShardRegion.GracefulShutdown$ |
static class |
ShardRegion.HandOffStopper
INTERNAL API.
|
static class |
ShardRegion.HashCodeMessageExtractor
Convenience implementation of
ShardRegion.MessageExtractor that
construct shardId based on the hashCode of the entityId . |
static interface |
ShardRegion.MessageExtractor
Java API: Interface of functions to extract entity id,
shard id, and the message to send to the entity from an
incoming message.
|
static class |
ShardRegion.Passivate
If the state of the entities are persistent you may stop entities that are not used to
reduce memory consumption.
|
static class |
ShardRegion.Passivate$ |
static class |
ShardRegion.ShardInitialized
We must be sure that a shard is initialized before to start send messages to it.
|
static class |
ShardRegion.ShardInitialized$ |
static interface |
ShardRegion.ShardRegionCommand |
static interface |
ShardRegion.ShardRegionQuery |
static class |
ShardRegion.ShardRegionStats |
static class |
ShardRegion.ShardRegionStats$ |
static class |
ShardRegion.ShardState |
static class |
ShardRegion.ShardState$ |
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
ShardRegion(java.lang.String typeName,
scala.Option<Props> entityProps,
ClusterShardingSettings settings,
java.lang.String coordinatorPath,
scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> extractEntityId,
scala.Function1<java.lang.Object,java.lang.String> extractShardId,
java.lang.Object handOffStopMessage) |
Modifier and Type | Method and Description |
---|---|
scala.math.Ordering<Member> |
ageOrdering() |
protected abstract static void |
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1) |
protected abstract static void |
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1) |
static void |
akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1) |
static LoggingAdapter |
akka$actor$ActorLogging$$_log() |
protected static void |
aroundPostRestart(java.lang.Throwable reason) |
protected static void |
aroundPostStop() |
protected static void |
aroundPreRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
protected static void |
aroundPreStart() |
protected static void |
aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
java.lang.Object msg) |
<T> scala.concurrent.Future<scala.collection.Seq<scala.Tuple2<java.lang.String,T>>> |
askAllShards(java.lang.Object msg,
scala.reflect.ClassTag<T> evidence$1) |
void |
bufferMessage(java.lang.String shardId,
java.lang.Object msg,
ActorRef snd) |
void |
changeMembers(scala.collection.immutable.SortedSet<Member> newMembers) |
Cluster |
cluster() |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
scala.Option<ActorRef> |
coordinator() |
scala.Option<ActorSelection> |
coordinatorSelection() |
void |
deliverBufferedMessages(java.lang.String shardId,
ActorRef receiver) |
void |
deliverMessage(java.lang.Object msg,
ActorRef snd) |
static ShardRegion.GetCurrentRegions$ |
getCurrentRegionsInstance()
Java API:
|
static ShardRegion.GetShardRegionStats$ |
getRegionStatsInstance()
Java API:
|
scala.Option<ActorRef> |
getShard(java.lang.String id) |
static ShardRegion.GetShardRegionState$ |
getShardRegionStateInstance()
Java API:
|
boolean |
gracefulShutdownInProgress() |
static ShardRegion.GracefulShutdown$ |
gracefulShutdownInstance()
Java API: Send this message to the
ShardRegion actor to handoff all shards that are hosted by
the ShardRegion and then the ShardRegion actor will be stopped. |
scala.collection.immutable.Set<ActorRef> |
handingOff() |
static Props |
handOffStopperProps(java.lang.String shard,
ActorRef replyTo,
scala.collection.immutable.Set<ActorRef> entities,
java.lang.Object stopMessage) |
void |
initializeShard(java.lang.String id,
ActorRef shard) |
static LoggingAdapter |
log() |
boolean |
loggedFullBufferWarning() |
boolean |
matchingRole(Member member) |
scala.collection.immutable.SortedSet<Member> |
membersByAge() |
static void |
postRestart(java.lang.Throwable reason) |
void |
postStop()
User overridable callback.
|
static void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
void |
preStart()
User overridable callback.
|
static Props |
props(java.lang.String typeName,
Props entityProps,
ClusterShardingSettings settings,
java.lang.String coordinatorPath,
scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> extractEntityId,
scala.Function1<java.lang.Object,java.lang.String> extractShardId,
java.lang.Object handOffStopMessage)
INTERNAL API
Factory method for the
Props of the ShardRegion actor. |
static Props |
proxyProps(java.lang.String typeName,
ClusterShardingSettings settings,
java.lang.String coordinatorPath,
scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> extractEntityId,
scala.Function1<java.lang.Object,java.lang.String> extractShardId)
INTERNAL API
Factory method for the
Props of the ShardRegion actor
when using it in proxy only mode. |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive()
This defines the initial actor behavior, it must return a partial function
with the actor logic.
|
void |
receiveClusterEvent(ClusterEvent.ClusterDomainEvent evt) |
void |
receiveClusterState(ClusterEvent.CurrentClusterState state) |
void |
receiveCommand(ShardRegion.ShardRegionCommand cmd) |
void |
receiveCoordinatorMessage(akka.cluster.sharding.ShardCoordinator.Internal.CoordinatorMessage msg) |
void |
receiveQuery(ShardRegion.ShardRegionQuery query) |
void |
receiveTerminated(ActorRef ref) |
scala.collection.immutable.Map<java.lang.String,ActorRef> |
regionByShard() |
scala.collection.immutable.Map<ActorRef,scala.collection.immutable.Set<java.lang.String>> |
regions() |
void |
register() |
java.lang.Object |
registrationMessage() |
void |
replyToRegionStateQuery(ActorRef ref) |
void |
replyToRegionStatsQuery(ActorRef ref) |
void |
requestShardBufferHomes() |
int |
retryCount() |
Cancellable |
retryTask() |
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
static ActorRef |
sender() |
void |
sendGracefulShutdownToCoordinator() |
MessageBufferMap<java.lang.String> |
shardBuffers() |
scala.collection.immutable.Map<java.lang.String,ActorRef> |
shards() |
scala.collection.immutable.Map<ActorRef,java.lang.String> |
shardsByRef() |
scala.collection.immutable.Set<java.lang.String> |
startingShards() |
static SupervisorStrategy |
supervisorStrategy() |
static void |
unhandled(java.lang.Object message) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, preRestart, sender, supervisorStrategy, unhandled
log
public ShardRegion(java.lang.String typeName, scala.Option<Props> entityProps, ClusterShardingSettings settings, java.lang.String coordinatorPath, scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> extractEntityId, scala.Function1<java.lang.Object,java.lang.String> extractShardId, java.lang.Object handOffStopMessage)
public static Props props(java.lang.String typeName, Props entityProps, ClusterShardingSettings settings, java.lang.String coordinatorPath, scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> extractEntityId, scala.Function1<java.lang.Object,java.lang.String> extractShardId, java.lang.Object handOffStopMessage)
Props
of the ShardRegion
actor.typeName
- (undocumented)entityProps
- (undocumented)settings
- (undocumented)coordinatorPath
- (undocumented)extractEntityId
- (undocumented)extractShardId
- (undocumented)handOffStopMessage
- (undocumented)public static Props proxyProps(java.lang.String typeName, ClusterShardingSettings settings, java.lang.String coordinatorPath, scala.PartialFunction<java.lang.Object,scala.Tuple2<java.lang.String,java.lang.Object>> extractEntityId, scala.Function1<java.lang.Object,java.lang.String> extractShardId)
Props
of the ShardRegion
actor
when using it in proxy only mode.typeName
- (undocumented)settings
- (undocumented)coordinatorPath
- (undocumented)extractEntityId
- (undocumented)extractShardId
- (undocumented)public static ShardRegion.GracefulShutdown$ gracefulShutdownInstance()
ShardRegion
actor to handoff all shards that are hosted by
the ShardRegion
and then the ShardRegion
actor will be stopped. You can watch
it to know when it is completed.public static ShardRegion.GetCurrentRegions$ getCurrentRegionsInstance()
public static ShardRegion.GetShardRegionStats$ getRegionStatsInstance()
public static ShardRegion.GetShardRegionState$ getShardRegionStateInstance()
public static Props handOffStopperProps(java.lang.String shard, ActorRef replyTo, scala.collection.immutable.Set<ActorRef> entities, java.lang.Object stopMessage)
public static final ActorRef sender()
protected static void aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, java.lang.Object msg)
protected static void aroundPreStart()
protected static void aroundPostStop()
protected static void aroundPreRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message)
protected static void aroundPostRestart(java.lang.Throwable reason)
public static SupervisorStrategy supervisorStrategy()
public static void preRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message) throws java.lang.Exception
java.lang.Exception
public static void postRestart(java.lang.Throwable reason) throws java.lang.Exception
java.lang.Exception
public static void unhandled(java.lang.Object message)
protected abstract static void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
protected abstract static void akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
public static LoggingAdapter akka$actor$ActorLogging$$_log()
public static void akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1)
public static LoggingAdapter log()
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public Cluster cluster()
public scala.math.Ordering<Member> ageOrdering()
public scala.collection.immutable.SortedSet<Member> membersByAge()
public scala.collection.immutable.Map<ActorRef,scala.collection.immutable.Set<java.lang.String>> regions()
public scala.collection.immutable.Map<java.lang.String,ActorRef> regionByShard()
public MessageBufferMap<java.lang.String> shardBuffers()
public boolean loggedFullBufferWarning()
public scala.collection.immutable.Map<java.lang.String,ActorRef> shards()
public scala.collection.immutable.Map<ActorRef,java.lang.String> shardsByRef()
public scala.collection.immutable.Set<java.lang.String> startingShards()
public scala.collection.immutable.Set<ActorRef> handingOff()
public boolean gracefulShutdownInProgress()
public Cancellable retryTask()
public int retryCount()
public void preStart()
Actor
public void postStop()
Actor
public boolean matchingRole(Member member)
public scala.Option<ActorSelection> coordinatorSelection()
public scala.Option<ActorRef> coordinator()
public void changeMembers(scala.collection.immutable.SortedSet<Member> newMembers)
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
public void receiveClusterState(ClusterEvent.CurrentClusterState state)
public void receiveClusterEvent(ClusterEvent.ClusterDomainEvent evt)
public void receiveCoordinatorMessage(akka.cluster.sharding.ShardCoordinator.Internal.CoordinatorMessage msg)
public void receiveCommand(ShardRegion.ShardRegionCommand cmd)
public void receiveQuery(ShardRegion.ShardRegionQuery query)
public void receiveTerminated(ActorRef ref)
public void replyToRegionStateQuery(ActorRef ref)
public void replyToRegionStatsQuery(ActorRef ref)
public <T> scala.concurrent.Future<scala.collection.Seq<scala.Tuple2<java.lang.String,T>>> askAllShards(java.lang.Object msg, scala.reflect.ClassTag<T> evidence$1)
public void register()
public java.lang.Object registrationMessage()
public void requestShardBufferHomes()
public void initializeShard(java.lang.String id, ActorRef shard)
public void bufferMessage(java.lang.String shardId, java.lang.Object msg, ActorRef snd)
public void deliverBufferedMessages(java.lang.String shardId, ActorRef receiver)
public void deliverMessage(java.lang.Object msg, ActorRef snd)
public scala.Option<ActorRef> getShard(java.lang.String id)
public void sendGracefulShutdownToCoordinator()