Package akka.cluster.sharding
Class ShardRegion
- java.lang.Object
-
- akka.cluster.sharding.ShardRegion
-
- All Implemented Interfaces:
Actor
,ActorLogging
public class ShardRegion extends java.lang.Object implements Actor, ActorLogging
When leaving the coordinator singleton is started rather quickly on next oldest node and therefore it is good to send the GracefulShutdownReq to the likely locations of the coordinator.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
-
Constructor Summary
Constructors Constructor Description ShardRegion(java.lang.String typeName, scala.Option<scala.Function1<java.lang.String,Props>> entityProps, scala.Option<java.lang.String> dataCenter, 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, ActorRef replicator, int majorityMinCap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description scala.math.Ordering<Member>
ageOrdering()
protected void
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
protected void
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
The 'self' field holds the ActorRef for this actor.<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()
Scala API: Stores the context for this actor, including self, and sender.scala.Option<ActorRef>
coordinator()
void
coordinator_$eq(scala.Option<ActorRef> x$1)
scala.Option<ActorSelection>
coordinatorSelection()
void
deliverBufferedMessages(java.lang.String shardId, ActorRef receiver)
void
deliverMessage(java.lang.Object msg, ActorRef snd)
void
deliverStartEntity(ShardRegion.StartEntity msg, ActorRef snd)
static ShardRegion.GetCurrentRegions$
getCurrentRegionsInstance()
static ShardRegion.GetShardRegionStats$
getRegionStatsInstance()
scala.Option<ActorRef>
getShard(java.lang.String id)
static ShardRegion.GetShardRegionState$
getShardRegionStateInstance()
scala.collection.immutable.List<ActorSelection>
gracefulShutdownCoordinatorSelections()
When leaving the coordinator singleton is started rather quickly on next oldest node and therefore it is good to send the GracefulShutdownReq to the likely locations of the coordinator.boolean
gracefulShutdownInProgress()
void
gracefulShutdownInProgress_$eq(boolean x$1)
static ShardRegion.GracefulShutdown$
gracefulShutdownInstance()
scala.concurrent.Promise<Done>
gracefulShutdownProgress()
scala.collection.immutable.Set<ActorRef>
handingOff()
void
handingOff_$eq(scala.collection.immutable.Set<ActorRef> x$1)
static Props
handOffStopperProps(java.lang.String shard, ActorRef replyTo, scala.collection.immutable.Set<ActorRef> entities, java.lang.Object stopMessage, scala.concurrent.duration.FiniteDuration handoffTimeout)
void
initializeShard(java.lang.String id, ActorRef shard)
boolean
loggedFullBufferWarning()
void
loggedFullBufferWarning_$eq(boolean x$1)
boolean
matchingRole(Member member)
scala.collection.immutable.SortedSet<Member>
membersByAge()
void
membersByAge_$eq(scala.collection.immutable.SortedSet<Member> x$1)
void
postStop()
User overridable callback.void
preStart()
User overridable callback.static Props
props(java.lang.String typeName, scala.Function1<java.lang.String,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, ActorRef replicator, int majorityMinCap)
static Props
proxyProps(java.lang.String typeName, scala.Option<java.lang.String> dataCenter, 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, ActorRef replicator, int majorityMinCap)
INTERNAL API Factory method for theProps
of theShardRegion
actor when using it in proxy only mode.scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
receive()
Scala API: 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()
void
regionByShard_$eq(scala.collection.immutable.Map<java.lang.String,ActorRef> x$1)
scala.collection.immutable.Map<ActorRef,scala.collection.immutable.Set<java.lang.String>>
regions()
void
regions_$eq(scala.collection.immutable.Map<ActorRef,scala.collection.immutable.Set<java.lang.String>> x$1)
void
register()
java.lang.Object
registrationMessage()
void
replyToRegionStateQuery(ActorRef ref)
void
replyToRegionStatsQuery(ActorRef ref)
void
requestShardBufferHomes()
int
retryCount()
void
retryCount_$eq(int x$1)
Cancellable
retryTask()
ActorRef
self()
The 'self' field holds the ActorRef for this actor.void
sendGracefulShutdownToCoordinator()
MessageBufferMap<java.lang.String>
shardBuffers()
void
shardBuffers_$eq(MessageBufferMap<java.lang.String> x$1)
scala.collection.immutable.Map<java.lang.String,ActorRef>
shards()
void
shards_$eq(scala.collection.immutable.Map<java.lang.String,ActorRef> x$1)
scala.collection.immutable.Map<ActorRef,java.lang.String>
shardsByRef()
void
shardsByRef_$eq(scala.collection.immutable.Map<ActorRef,java.lang.String> x$1)
scala.collection.immutable.Set<java.lang.String>
startingShards()
void
startingShards_$eq(scala.collection.immutable.Set<java.lang.String> x$1)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, preRestart, sender, supervisorStrategy, unhandled
-
Methods inherited from interface akka.actor.ActorLogging
_log_$eq, log
-
-
-
-
Constructor Detail
-
ShardRegion
public ShardRegion(java.lang.String typeName, scala.Option<scala.Function1<java.lang.String,Props>> entityProps, scala.Option<java.lang.String> dataCenter, 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, ActorRef replicator, int majorityMinCap)
-
-
Method Detail
-
props
public static Props props(java.lang.String typeName, scala.Function1<java.lang.String,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, ActorRef replicator, int majorityMinCap)
-
proxyProps
public static Props proxyProps(java.lang.String typeName, scala.Option<java.lang.String> dataCenter, 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, ActorRef replicator, int majorityMinCap)
INTERNAL API Factory method for theProps
of theShardRegion
actor when using it in proxy only mode.- Parameters:
typeName
- (undocumented)dataCenter
- (undocumented)settings
- (undocumented)coordinatorPath
- (undocumented)extractEntityId
- (undocumented)extractShardId
- (undocumented)replicator
- (undocumented)majorityMinCap
- (undocumented)- Returns:
- (undocumented)
-
gracefulShutdownInstance
public static ShardRegion.GracefulShutdown$ gracefulShutdownInstance()
-
getCurrentRegionsInstance
public static ShardRegion.GetCurrentRegions$ getCurrentRegionsInstance()
-
getRegionStatsInstance
public static ShardRegion.GetShardRegionStats$ getRegionStatsInstance()
-
getShardRegionStateInstance
public static ShardRegion.GetShardRegionState$ getShardRegionStateInstance()
-
handOffStopperProps
public static Props handOffStopperProps(java.lang.String shard, ActorRef replyTo, scala.collection.immutable.Set<ActorRef> entities, java.lang.Object stopMessage, scala.concurrent.duration.FiniteDuration handoffTimeout)
-
context
public ActorContext context()
Description copied from interface:Actor
Scala API: Stores the context for this actor, including self, and sender. It is implicit to support operations such asforward
.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 aAbstractActor.ActorContext
, which is the Java API of the actor context.
-
self
public final ActorRef self()
Description copied from interface:Actor
The 'self' field holds the ActorRef for this actor. Can be used to send messages to itself:self ! message
-
akka$actor$Actor$_setter_$context_$eq
protected void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
- Specified by:
akka$actor$Actor$_setter_$context_$eq
in interfaceActor
-
akka$actor$Actor$_setter_$self_$eq
protected final void akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
Description copied from interface:Actor
The 'self' field holds the ActorRef for this actor. Can be used to send messages to itself:self ! message
- Specified by:
akka$actor$Actor$_setter_$self_$eq
in interfaceActor
- Parameters:
x$1
- (undocumented)
-
cluster
public Cluster cluster()
-
ageOrdering
public scala.math.Ordering<Member> ageOrdering()
-
membersByAge
public scala.collection.immutable.SortedSet<Member> membersByAge()
-
membersByAge_$eq
public void membersByAge_$eq(scala.collection.immutable.SortedSet<Member> x$1)
-
regions
public scala.collection.immutable.Map<ActorRef,scala.collection.immutable.Set<java.lang.String>> regions()
-
regions_$eq
public void regions_$eq(scala.collection.immutable.Map<ActorRef,scala.collection.immutable.Set<java.lang.String>> x$1)
-
regionByShard
public scala.collection.immutable.Map<java.lang.String,ActorRef> regionByShard()
-
regionByShard_$eq
public void regionByShard_$eq(scala.collection.immutable.Map<java.lang.String,ActorRef> x$1)
-
shardBuffers
public MessageBufferMap<java.lang.String> shardBuffers()
-
shardBuffers_$eq
public void shardBuffers_$eq(MessageBufferMap<java.lang.String> x$1)
-
loggedFullBufferWarning
public boolean loggedFullBufferWarning()
-
loggedFullBufferWarning_$eq
public void loggedFullBufferWarning_$eq(boolean x$1)
-
shards
public scala.collection.immutable.Map<java.lang.String,ActorRef> shards()
-
shards_$eq
public void shards_$eq(scala.collection.immutable.Map<java.lang.String,ActorRef> x$1)
-
shardsByRef
public scala.collection.immutable.Map<ActorRef,java.lang.String> shardsByRef()
-
shardsByRef_$eq
public void shardsByRef_$eq(scala.collection.immutable.Map<ActorRef,java.lang.String> x$1)
-
startingShards
public scala.collection.immutable.Set<java.lang.String> startingShards()
-
startingShards_$eq
public void startingShards_$eq(scala.collection.immutable.Set<java.lang.String> x$1)
-
handingOff
public scala.collection.immutable.Set<ActorRef> handingOff()
-
handingOff_$eq
public void handingOff_$eq(scala.collection.immutable.Set<ActorRef> x$1)
-
gracefulShutdownInProgress
public boolean gracefulShutdownInProgress()
-
gracefulShutdownInProgress_$eq
public void gracefulShutdownInProgress_$eq(boolean x$1)
-
retryTask
public Cancellable retryTask()
-
retryCount
public int retryCount()
-
retryCount_$eq
public void retryCount_$eq(int x$1)
-
gracefulShutdownProgress
public scala.concurrent.Promise<Done> gracefulShutdownProgress()
-
preStart
public void preStart()
Description copied from interface:Actor
User overridable callback. Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.
-
postStop
public void postStop()
Description copied from interface:Actor
User overridable callback. Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.
-
matchingRole
public boolean matchingRole(Member member)
-
coordinatorSelection
public scala.Option<ActorSelection> coordinatorSelection()
-
gracefulShutdownCoordinatorSelections
public scala.collection.immutable.List<ActorSelection> gracefulShutdownCoordinatorSelections()
When leaving the coordinator singleton is started rather quickly on next oldest node and therefore it is good to send the GracefulShutdownReq to the likely locations of the coordinator.- Returns:
- (undocumented)
-
coordinator
public scala.Option<ActorRef> coordinator()
-
coordinator_$eq
public void coordinator_$eq(scala.Option<ActorRef> x$1)
-
changeMembers
public void changeMembers(scala.collection.immutable.SortedSet<Member> newMembers)
-
receive
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Description copied from interface:Actor
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.
-
receiveClusterState
public void receiveClusterState(ClusterEvent.CurrentClusterState state)
-
receiveClusterEvent
public void receiveClusterEvent(ClusterEvent.ClusterDomainEvent evt)
-
receiveCoordinatorMessage
public void receiveCoordinatorMessage(akka.cluster.sharding.ShardCoordinator.Internal.CoordinatorMessage msg)
-
receiveCommand
public void receiveCommand(ShardRegion.ShardRegionCommand cmd)
-
receiveQuery
public void receiveQuery(ShardRegion.ShardRegionQuery query)
-
receiveTerminated
public void receiveTerminated(ActorRef ref)
-
replyToRegionStateQuery
public void replyToRegionStateQuery(ActorRef ref)
-
replyToRegionStatsQuery
public void replyToRegionStatsQuery(ActorRef ref)
-
askAllShards
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)
-
register
public void register()
-
registrationMessage
public java.lang.Object registrationMessage()
-
requestShardBufferHomes
public void requestShardBufferHomes()
-
initializeShard
public void initializeShard(java.lang.String id, ActorRef shard)
-
bufferMessage
public void bufferMessage(java.lang.String shardId, java.lang.Object msg, ActorRef snd)
-
deliverBufferedMessages
public void deliverBufferedMessages(java.lang.String shardId, ActorRef receiver)
-
deliverStartEntity
public void deliverStartEntity(ShardRegion.StartEntity msg, ActorRef snd)
-
deliverMessage
public void deliverMessage(java.lang.Object msg, ActorRef snd)
-
getShard
public scala.Option<ActorRef> getShard(java.lang.String id)
-
sendGracefulShutdownToCoordinator
public void sendGracefulShutdownToCoordinator()
-
-