Skip to content

BrokerActor

Defined in: src/io/broker/BrokerActor.ts:62

Base class for actors that bridge external messaging systems (MQTT, WebSocket, Kafka, …) into the actor system. Subclasses implement three protocol hooks (connectImpl, disconnectImpl, dispatchOutgoing); the base class owns the lifecycle, reconnect- backoff, outbound buffer, subscriber fan-out, and lifecycle-event publishing.

Settings precedence (highest first):

  1. Constructor argument (per-instance overrides).
  2. HOCON config under configKey() (system-wide defaults).
  3. Built-in defaults from builtInDefaults().

Subclasses pass their constructor settings via super(settings) and implement configKey(), builtInDefaults(), readSettingsFromConfig(), and requiredSettings() so the base class can resolve and validate the effective settings before connectImpl() runs.

S extends BrokerCommonSettings

Cmd = unknown

P = unknown

abstract onReceive(message): void | Promise<void>

Defined in: src/Actor.ts:38

Main message handler. Receives each envelope dequeued from the mailbox. A thrown error (sync or async) is caught by the supervisor.

Cmd

void | Promise<void>

Actor.onReceive


postRestart(_reason): void | Promise<void>

Defined in: src/Actor.ts:55

Called on the fresh instance after a restart. Default: call preStart().

Error

void | Promise<void>

Actor.postRestart


postStop(): Promise<void>

Defined in: src/io/broker/BrokerActor.ts:241

Called after the actor has been terminated. Children are already stopped.

Promise<void>

Actor.postStop


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

Error

Cmd

void | Promise<void>

Actor.preRestart


preStart(): Promise<void>

Defined in: src/io/broker/BrokerActor.ts:235

Called after construction and before the first message is processed.

Promise<void>

Actor.preStart


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.

SupervisorStrategy

Actor.supervisorStrategy