Pular para o conteúdo
Português (BR)

ShardingOptionsBuilder

Este conteúdo não está disponível em sua língua ainda.

Defined in: src/cluster/sharding/ShardingOptions.ts:118

Fluent builder for ShardingOptionsType. Base of the builder inheritance chain: StartShardingOptionsBuilder (in StartShardingOptions) extends this and adds the coordinator-side fields. Each concrete withX records exactly one field so unset fields fall through to HOCON / built-in defaults when the options are normalised by ShardRegion.settingsToConfig.

The whole-object fields — entityActor, entityOptions, and the extractEntityId / extractEntityMessage extractors — are passed as-is via a single withX(value); no nested builders.

TMessage

S extends ShardingOptionsType<TMessage> = ShardingOptionsType<TMessage>

new ShardingOptionsBuilder<TMessage, S>(): ShardingOptionsBuilder<TMessage, S>

ShardingOptionsBuilder<TMessage, S>

OptionsBuilder.constructor

build(): Partial<T>

Defined in: src/util/OptionsBuilder.ts:51

Snapshot the set fields as an independent Partial<T> (own props only).

Partial<T>

OptionsBuilder.build


withEntityActor(entityActor): this

Defined in: src/cluster/sharding/ShardingOptions.ts:133

The actor each entity instance is built from.

ActorClassOrFactory<TMessage>

this


withEntityOptions(entityOptions): this

Defined in: src/cluster/sharding/ShardingOptions.ts:138

Spawn options applied to every entity of this type.

ActorOptions<TMessage>

this


withExtractEntityId(extractEntityId): this

Defined in: src/cluster/sharding/ShardingOptions.ts:143

Derive the stable entity id from an incoming message.

(message) => string

this


withExtractEntityMessage(extractEntityMessage): this

Defined in: src/cluster/sharding/ShardingOptions.ts:148

Unwrap the payload actually delivered to the entity. Default: identity.

(message) => unknown

this


withMaxEntities(maxEntities): this

Defined in: src/cluster/sharding/ShardingOptions.ts:183

Cap the number of locally-hosted entities; LRU-passivate on overflow. Default: 0 (no cap).

number

this


withNumShards(numShards): this

Defined in: src/cluster/sharding/ShardingOptions.ts:153

Number of shards to spread entities across. Default: 64.

number

this


withPassivationIdleMs(passivationIdleMs): this

Defined in: src/cluster/sharding/ShardingOptions.ts:173

Passivate an entity after it has been idle this many ms. Default: 5 min; 0 disables.

number

this


withProxy(proxy?): this

Defined in: src/cluster/sharding/ShardingOptions.ts:163

Run as a proxy — route messages but never host entities locally.

boolean = true

this


withRememberEntities(rememberEntities?): this

Defined in: src/cluster/sharding/ShardingOptions.ts:168

Track entity lifecycle so entities can be re-created on the new owner.

boolean = true

this


withRole(role): this

Defined in: src/cluster/sharding/ShardingOptions.ts:158

Members must carry this role to be candidates for hosting shards.

string

this


withShardPassivationIdleMs(shardPassivationIdleMs): this

Defined in: src/cluster/sharding/ShardingOptions.ts:178

Stop a shard once it has stood empty this many ms. Default: follows passivationIdleMs.

number

this


withTypeName(typeName): this

Defined in: src/cluster/sharding/ShardingOptions.ts:128

Logical name of the sharded type.

string

this


static create<TMessage>(): ShardingOptionsBuilder<TMessage>

Defined in: src/cluster/sharding/ShardingOptions.ts:123

Start a fresh builder. Equivalent to new ShardingOptionsBuilder<TMessage>().

TMessage

ShardingOptionsBuilder<TMessage>