コンテンツにスキップ
日本語

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 concrete withX(...) calls the protected set and returns this, so chaining stays typed as the concrete subclass across inheritance levels (no F-bounded Self generic needed — this already 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 XOptions union (XOptionsBuilder | Partial<XOptionsType>) and read / spread the argument directly — no separate “resolve” step. The withX / build methods 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 bare Partial<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 independent Partial<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 of mergeOptions(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).

T extends ActorSystemOptionsType = ActorSystemOptionsType

new ActorSystemOptionsBuilder<T>(): ActorSystemOptionsBuilder<T>

ActorSystemOptionsBuilder<T>

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


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.

ConfigObject | Config

this


withConfigFile(configFile): this

Defined in: src/ActorSystemOptions.ts:289

Explicit path to application.conf (overrides ACTOR_TS_CONFIG + CWD lookup); false reads none.

string | false

this


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.

NonNullable<CoordinatedStartupOptions | undefined>

this


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.

NonNullable<DeadLetterQueueOptions | undefined>

this


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.

NonNullable<DiagnosticsOptions | undefined>

this


withDispatcher(dispatcher): this

Defined in: src/ActorSystemOptions.ts:270

Custom dispatcher for the system’s default mailbox scheduling.

Dispatcher

this


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.

string | false

this


withLogger(logger): this

Defined in: src/ActorSystemOptions.ts:238

System logger, used as it is. Wins over withOtelLogs, withLogSinks and the HOCON/console default.

Logger

this


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).

LogLevel

this


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.

readonly LogSink[]

this


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.

NonNullable<MessageBoundaryOptions | undefined>

this


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.

OtelLogsAdapterOptions

this


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.

NonNullable<ParallelismOptions | undefined>

this


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.

PersistenceBehaviorOptions

DurableStateStore

Journal

readonly PersistencePlugin[]

SnapshotStore

this


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.

string

this


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.

string | false

this


withScheduler(scheduler): this

Defined in: src/ActorSystemOptions.ts:275

Custom scheduler — typically a ManualScheduler in tests.

Scheduler

this


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.

string | false

this


static create(): ActorSystemOptionsBuilder

Defined in: src/ActorSystemOptions.ts:225

Start a fresh builder. Equivalent to new ActorSystemOptionsBuilder().

ActorSystemOptionsBuilder