ShardRegion
Defined in: src/cluster/sharding/ShardRegion.ts:100
ShardRegion is the node-local router for a sharded type. It talks to the ShardCoordinator to discover the home of each shard, hosts entities whose shards live locally, and forwards everything else to the remote region that owns the target shard. Messages whose shard home is unknown or in handoff are buffered until the coordinator answers.
Extends
Section titled “Extends”Actor<TMsg|ShardingMessage|Terminated|Passivate>
Type Parameters
Section titled “Type Parameters”TMsg = unknown
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ShardRegion<
TMsg>(cfg):ShardRegion<TMsg>
Defined in: src/cluster/sharding/ShardRegion.ts:128
Parameters
Section titled “Parameters”ShardRegionConfig<TMsg>
Returns
Section titled “Returns”ShardRegion<TMsg>
Overrides
Section titled “Overrides”Properties
Section titled “Properties”
readonlycfg:ShardRegionConfig<TMsg>
Defined in: src/cluster/sharding/ShardRegion.ts:128
Methods
Section titled “Methods”onReceive()
Section titled “onReceive()”onReceive(
message):void
Defined in: src/cluster/sharding/ShardRegion.ts:185
Main message handler. Receives each envelope dequeued from the mailbox. A thrown error (sync or async) is caught by the supervisor.
Parameters
Section titled “Parameters”message
Section titled “message”Terminated | Passivate | ShardingMessage | TMsg
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”postRestart()
Section titled “postRestart()”postRestart(
_reason):void|Promise<void>
Defined in: src/Actor.ts:55
Called on the fresh instance after a restart. Default: call preStart().
Parameters
Section titled “Parameters”_reason
Section titled “_reason”Error
Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”postStop()
Section titled “postStop()”postStop():
void
Defined in: src/cluster/sharding/ShardRegion.ts:178
Called after the actor has been terminated. Children are already stopped.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”preRestart()
Section titled “preRestart()”preRestart(
_reason,_message?):void|Promise<void>
Defined in: src/Actor.ts:50
Called before a restart, on the instance about to be thrown away. The default stops children and then calls postStop().
Parameters
Section titled “Parameters”_reason
Section titled “_reason”Error
_message?
Section titled “_message?”Terminated | Passivate | ShardingMessage | TMsg
Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”preStart()
Section titled “preStart()”preStart():
void
Defined in: src/cluster/sharding/ShardRegion.ts:151
Called after construction and before the first message is processed.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”supervisorStrategy()
Section titled “supervisorStrategy()”supervisorStrategy():
SupervisorStrategy
Defined in: src/Actor.ts:63
Supervisor strategy for this actor’s children. Defaults to restart, up to 10 times per minute, then stop.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”settingsToConfig()
Section titled “settingsToConfig()”
staticsettingsToConfig<TMsg>(s,cluster,localResolver):ShardRegionConfig<TMsg>
Defined in: src/cluster/sharding/ShardRegion.ts:130
Type Parameters
Section titled “Type Parameters”TMsg
Parameters
Section titled “Parameters”ShardingSettings<TMsg>
cluster
Section titled “cluster”localResolver
Section titled “localResolver”(path) => ActorRef<unknown> | null
Returns
Section titled “Returns”ShardRegionConfig<TMsg>