public class Shard extends java.lang.Object implements Actor, ActorLogging
This actor creates children entity actors on demand that it is told to be responsible for.
ClusterSharding extension
Modifier and Type | Class and Description |
---|---|
static class |
Shard.CurrentShardState |
static class |
Shard.CurrentShardState$ |
static class |
Shard.EntityStarted
State change for starting an entity in this Shard |
static class |
Shard.EntityStarted$ |
static class |
Shard.EntityStopped
State change for an entity which has terminated. |
static class |
Shard.EntityStopped$ |
static class |
Shard.GetCurrentShardState$ |
static class |
Shard.GetShardStats$ |
static class |
Shard.RestartEntities
When initialising a shard with remember entities enabled the following message is used
to restart batches of entity actors at a time.
|
static class |
Shard.RestartEntities$ |
static class |
Shard.RestartEntity
When an remembering entities and the entity stops without issuing a
Passivate , we
restart it after a back off using this message. |
static class |
Shard.RestartEntity$ |
static interface |
Shard.ShardCommand
A Shard command
|
static interface |
Shard.ShardQuery
A query for information about the shard
|
static class |
Shard.ShardStats |
static class |
Shard.ShardStats$ |
static class |
Shard.State |
static class |
Shard.State$ |
static interface |
Shard.StateChange
A case class which represents a state change for the Shard
|
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
Shard(java.lang.String typeName,
java.lang.String shardId,
Props entityProps,
ClusterShardingSettings settings,
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 |
---|---|
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) |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
void |
deliverMessage(java.lang.Object msg,
ActorRef snd) |
void |
deliverTo(java.lang.String id,
java.lang.Object msg,
java.lang.Object payload,
ActorRef snd) |
void |
entityTerminated(ActorRef ref) |
ActorRef |
getEntity(java.lang.String id) |
void |
handOff(ActorRef replyTo) |
scala.Option<ActorRef> |
handOffStopper() |
scala.collection.immutable.Map<ActorRef,java.lang.String> |
idByRef() |
void |
initialized() |
static LoggingAdapter |
log() |
MessageBufferMap<java.lang.String> |
messageBuffers() |
void |
passivate(ActorRef entity,
java.lang.Object stopMessage) |
void |
passivateCompleted(Shard.EntityStopped event) |
scala.collection.immutable.Set<ActorRef> |
passivating() |
static void |
postRestart(java.lang.Throwable reason) |
static void |
postStop() |
static void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
static void |
preStart() |
<A> void |
processChange(A event,
scala.Function1<A,scala.runtime.BoxedUnit> handler) |
static Props |
props(java.lang.String typeName,
java.lang.String shardId,
Props entityProps,
ClusterShardingSettings settings,
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)
|
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.
|
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receiveCommand() |
void |
receiveCoordinatorMessage(akka.cluster.sharding.ShardCoordinator.Internal.CoordinatorMessage msg) |
void |
receiveShardCommand(Shard.ShardCommand msg) |
void |
receiveShardQuery(Shard.ShardQuery msg) |
void |
receiveShardRegionCommand(ShardRegion.ShardRegionCommand msg) |
void |
receiveTerminated(ActorRef ref) |
scala.collection.immutable.Map<java.lang.String,ActorRef> |
refById() |
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
static ActorRef |
sender() |
void |
sendMsgBuffer(Shard.EntityStarted event) |
Shard.State |
state() |
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, postStop, preRestart, preStart, sender, supervisorStrategy, unhandled
log
public Shard(java.lang.String typeName, java.lang.String shardId, Props entityProps, ClusterShardingSettings settings, 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, java.lang.String shardId, Props entityProps, ClusterShardingSettings settings, 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 Shard
actor.
If settings.rememberEntities
is enabled the PersistentShard
subclass is used, otherwise Shard
.typeName
- (undocumented)shardId
- (undocumented)entityProps
- (undocumented)settings
- (undocumented)extractEntityId
- (undocumented)extractShardId
- (undocumented)handOffStopMessage
- (undocumented)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 preStart() throws java.lang.Exception
java.lang.Exception
public static void postStop() throws java.lang.Exception
java.lang.Exception
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 Shard.State state()
public scala.collection.immutable.Map<ActorRef,java.lang.String> idByRef()
public scala.collection.immutable.Map<java.lang.String,ActorRef> refById()
public scala.collection.immutable.Set<ActorRef> passivating()
public MessageBufferMap<java.lang.String> messageBuffers()
public scala.Option<ActorRef> handOffStopper()
public void initialized()
public <A> void processChange(A event, scala.Function1<A,scala.runtime.BoxedUnit> handler)
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receiveCommand()
public void receiveShardCommand(Shard.ShardCommand msg)
public void receiveShardRegionCommand(ShardRegion.ShardRegionCommand msg)
public void receiveCoordinatorMessage(akka.cluster.sharding.ShardCoordinator.Internal.CoordinatorMessage msg)
public void receiveShardQuery(Shard.ShardQuery msg)
public void handOff(ActorRef replyTo)
public void receiveTerminated(ActorRef ref)
public void entityTerminated(ActorRef ref)
public void passivate(ActorRef entity, java.lang.Object stopMessage)
public void passivateCompleted(Shard.EntityStopped event)
public void sendMsgBuffer(Shard.EntityStarted event)
public void deliverMessage(java.lang.Object msg, ActorRef snd)
public void deliverTo(java.lang.String id, java.lang.Object msg, java.lang.Object payload, ActorRef snd)
public ActorRef getEntity(java.lang.String id)