ActorSystemOptionsBuilder
此内容尚不支持你的语言。
Defined in: src/ActorSystemOptions.ts:223
Base class for the framework’s fluent options builders — the shared
mechanics behind MqttOptions, KafkaOptions, ActorSystemOptions,
and every other <X>Options builder.
Design (matches the hand-written MqttOptions that seeded this):
- Mutable,
this-returning. Each concretewithX(...)calls the protected set and returnsthis, so chaining stays typed as the concrete subclass across inheritance levels (no F-boundedSelfgeneric needed —thisalready IS the subclass). - A builder is its options. set writes each field as an
own enumerable property of the builder instance, so a builder is
structurally a bag of the fields you set. Consumers accept the
XOptionsunion (XOptionsBuilder | Partial<XOptionsType>) and read / spread the argument directly — no separate “resolve” step. ThewithX/buildmethods live on the prototype, so they never surface when the options are spread ({ ...options }), enumerated (Object.keys), or serialized (JSON.stringify): only the set fields do. (The consumer keeps the union in its signature because a builder — a methods-only type — is not assignable to a barePartial<T>: TypeScript’s weak-type check would reject it. Reading the options out of the argument is a plain cast:options as XOptionsType/{ ...(options as Partial<XOptionsType>) }.) build()snapshots. It returns an independentPartial<T>(a copy of the own fields) for the rare caller that wants to freeze a builder it intends to keep mutating; ordinary consumers don’t need it because they already read/spread the argument.- Feeds the existing resolution. Wherever HOCON is layered in — the
broker actors,
ClusterSharding.start— the options are the highest-precedence layer ofmergeOptions(defaults, HOCON, explicit); because a builder records ONLY the fields you set, unset fields fall through to HOCON — the builder never competes with config.
A builder instance is a throwaway construction helper: methods mutate in place, so a single instance is not a branch point (two chains off the same instance share state).
Extends
Section titled “Extends”Type Parameters
Section titled “Type Parameters”T extends ActorSystemOptionsType = ActorSystemOptionsType
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ActorSystemOptionsBuilder<
T>():ActorSystemOptionsBuilder<T>
Returns
Section titled “Returns”ActorSystemOptionsBuilder<T>
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”build()
Section titled “build()”build():
Partial<T>
Defined in: src/util/OptionsBuilder.ts:51
Snapshot the set fields as an independent Partial<T> (own props only).
Returns
Section titled “Returns”Partial<T>
Inherited from
Section titled “Inherited from”withConfig()
Section titled “withConfig()”withConfig(
config):this
Defined in: src/ActorSystemOptions.ts:284
Application config — a prebuilt Config or a plain object of overrides.
A plain object is nested the way the HOCON is, { 'actor-ts': { system: { name: 'orders' } } }:
a dotted key such as 'actor-ts.system.name' is one literal key, which nothing reads.
Parameters
Section titled “Parameters”config
Section titled “config”Returns
Section titled “Returns”this
withConfigFile()
Section titled “withConfigFile()”withConfigFile(
configFile):this
Defined in: src/ActorSystemOptions.ts:289
Explicit path to application.conf (overrides ACTOR_TS_CONFIG + CWD lookup); false reads none.
Parameters
Section titled “Parameters”configFile
Section titled “configFile”string | false
Returns
Section titled “Returns”this
withCoordinatedStartup()
Section titled “withCoordinatedStartup()”withCoordinatedStartup(
coordinatedStartup):this
Defined in: src/ActorSystemOptions.ts:366
The startup graph — tasks the system runs in phases as the last step of
create, awaited through system.whenReady(). The only way in: the
graph is sealed once create returns.
Parameters
Section titled “Parameters”coordinatedStartup
Section titled “coordinatedStartup”NonNullable<CoordinatedStartupOptions | undefined>
Returns
Section titled “Returns”this
withDeadLetters()
Section titled “withDeadLetters()”withDeadLetters(
deadLetters):this
Defined in: src/ActorSystemOptions.ts:330
Dead-letter queue settings, layered over actor-ts.dead-letters.*.
Fields you leave unset still fall through to HOCON.
Parameters
Section titled “Parameters”deadLetters
Section titled “deadLetters”NonNullable<DeadLetterQueueOptions | undefined>
Returns
Section titled “Returns”this
withDiagnostics()
Section titled “withDiagnostics()”withDiagnostics(
diagnostics):this
Defined in: src/ActorSystemOptions.ts:339
Diagnostics settings, layered over actor-ts.diagnostics.* — how loudly
the runtime reports itself. Fields you leave unset still fall through
to HOCON.
Parameters
Section titled “Parameters”diagnostics
Section titled “diagnostics”NonNullable<DiagnosticsOptions | undefined>
Returns
Section titled “Returns”this
withDispatcher()
Section titled “withDispatcher()”withDispatcher(
dispatcher):this
Defined in: src/ActorSystemOptions.ts:270
Custom dispatcher for the system’s default mailbox scheduling.
Parameters
Section titled “Parameters”dispatcher
Section titled “dispatcher”Returns
Section titled “Returns”this
withEnvironmentFile()
Section titled “withEnvironmentFile()”withEnvironmentFile(
environmentFile):this
Defined in: src/ActorSystemOptions.ts:304
Explicit path to the .env file (overrides ACTOR_TS_ENV_FILE + CWD lookup); false reads none.
Parameters
Section titled “Parameters”environmentFile
Section titled “environmentFile”string | false
Returns
Section titled “Returns”this
withLogger()
Section titled “withLogger()”withLogger(
logger):this
Defined in: src/ActorSystemOptions.ts:238
System logger, used as it is. Wins over withOtelLogs, withLogSinks and the HOCON/console default.
Parameters
Section titled “Parameters”logger
Section titled “logger”Returns
Section titled “Returns”this
withLogLevel()
Section titled “withLogLevel()”withLogLevel(
logLevel):this
Defined in: src/ActorSystemOptions.ts:265
Minimum log level of the logger the system builds — the sinks, the
console default, and the withOtelLogs logger unless its options set
their own (ignored if withLogger is set).
Parameters
Section titled “Parameters”logLevel
Section titled “logLevel”Returns
Section titled “Returns”this
withLogSinks()
Section titled “withLogSinks()”withLogSinks(
logSinks):this
Defined in: src/ActorSystemOptions.ts:256
Log destinations, wrapped in a MultiSinkLogger by the system.
Ignored if withLogger or withOtelLogs is set.
Parameters
Section titled “Parameters”logSinks
Section titled “logSinks”readonly LogSink[]
Returns
Section titled “Returns”this
withMessageBoundary()
Section titled “withMessageBoundary()”withMessageBoundary(
messageBoundary):this
Defined in: src/ActorSystemOptions.ts:348
Message-boundary checks, layered over
actor-ts.diagnostics.message-boundary.* — whether a local tell is
examined the way a worker hop or a cluster wire would examine it.
Parameters
Section titled “Parameters”messageBoundary
Section titled “messageBoundary”NonNullable<MessageBoundaryOptions | undefined>
Returns
Section titled “Returns”this
withOtelLogs()
Section titled “withOtelLogs()”withOtelLogs(
otelLogs):this
Defined in: src/ActorSystemOptions.ts:248
Build the system logger from the OpenTelemetry Logs API — otelLogger
with these options, actor-ts.tracing.logger-name / logger-version
layered under them. Ignored if withLogger is set; wins over
withLogSinks and the HOCON sinks.
Parameters
Section titled “Parameters”otelLogs
Section titled “otelLogs”OtelLogsAdapterOptions
Returns
Section titled “Returns”this
withParallelism()
Section titled “withParallelism()”withParallelism(
parallelism):this
Defined in: src/ActorSystemOptions.ts:357
Parallelism settings, layered over actor-ts.parallelism.* — which
actors run on worker threads, and how many threads. Fields you leave
unset still fall through to HOCON.
Parameters
Section titled “Parameters”parallelism
Section titled “parallelism”NonNullable<ParallelismOptions | undefined>
Returns
Section titled “Returns”this
withPersistence()
Section titled “withPersistence()”withPersistence(
persistence):this
Defined in: src/ActorSystemOptions.ts:322
Persistence wired at system creation: plug-ins that register backends
before create returns, store instances that win over the plug-in
their axis selects, and the behaviour layered over actor-ts.persistence.
Parameters
Section titled “Parameters”persistence
Section titled “persistence”behavior?
Section titled “behavior?”PersistenceBehaviorOptions
durableStateStore?
Section titled “durableStateStore?”DurableStateStore
journal?
Section titled “journal?”Journal
plugins?
Section titled “plugins?”readonly PersistencePlugin[]
snapshotStore?
Section titled “snapshotStore?”SnapshotStore
Returns
Section titled “Returns”this
withProfile()
Section titled “withProfile()”withProfile(
profile):this
Defined in: src/ActorSystemOptions.ts:313
The config profile laid over each file the loader reads (overrides
ACTOR_TS_PROFILE). An empty name selects none, whatever the
environment says.
Parameters
Section titled “Parameters”profile
Section titled “profile”string
Returns
Section titled “Returns”this
withReferenceConfigFile()
Section titled “withReferenceConfigFile()”withReferenceConfigFile(
referenceConfigFile):this
Defined in: src/ActorSystemOptions.ts:294
Explicit path to the project’s reference.conf (overrides ACTOR_TS_REFERENCE_CONFIG + CWD lookup); false reads none.
Parameters
Section titled “Parameters”referenceConfigFile
Section titled “referenceConfigFile”string | false
Returns
Section titled “Returns”this
withScheduler()
Section titled “withScheduler()”withScheduler(
scheduler):this
Defined in: src/ActorSystemOptions.ts:275
Custom scheduler — typically a ManualScheduler in tests.
Parameters
Section titled “Parameters”scheduler
Section titled “scheduler”Returns
Section titled “Returns”this
withSecretsFile()
Section titled “withSecretsFile()”withSecretsFile(
secretsFile):this
Defined in: src/ActorSystemOptions.ts:299
Explicit path to the secrets file (overrides ACTOR_TS_SECRETS_CONF + CWD lookup); false reads none.
Parameters
Section titled “Parameters”secretsFile
Section titled “secretsFile”string | false
Returns
Section titled “Returns”this
create()
Section titled “create()”
staticcreate():ActorSystemOptionsBuilder
Defined in: src/ActorSystemOptions.ts:225
Start a fresh builder. Equivalent to new ActorSystemOptionsBuilder().
Returns
Section titled “Returns”ActorSystemOptionsBuilder
