Skip to content
English

ActorSystemOptionsBuilder

Defined in: src/ActorSystemOptions.ts:58

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:93

Application config — a prebuilt Config or a plain object of overrides.

ConfigObject | Config

this


withConfigFile(configFile): this

Defined in: src/ActorSystemOptions.ts:98

Explicit path to application.conf (overrides ACTOR_TS_CONFIG + CWD lookup).

string

this


withDispatcher(dispatcher): this

Defined in: src/ActorSystemOptions.ts:83

Custom dispatcher for the system’s default mailbox scheduling.

Dispatcher

this


withLogger(logger): this

Defined in: src/ActorSystemOptions.ts:73

System logger. Overrides the HOCON/console default.

Logger

this


withLogLevel(logLevel): this

Defined in: src/ActorSystemOptions.ts:78

Minimum log level for the default console logger (ignored if withLogger is set).

LogLevel

this


withPersistence(persistence): this

Defined in: src/ActorSystemOptions.ts:103

Wire a real journal / snapshot store at system creation time.

Journal

SnapshotStore

this


withScheduler(scheduler): this

Defined in: src/ActorSystemOptions.ts:88

Custom scheduler — typically a ManualScheduler in tests.

Scheduler

this


static create(): ActorSystemOptionsBuilder

Defined in: src/ActorSystemOptions.ts:60

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

ActorSystemOptionsBuilder