Skip to content

DistributedPubSubMediator

Defined in: src/cluster/pubsub/DistributedPubSubMediator.ts:55

Cluster-wide publish/subscribe bus. Every node hosts one mediator which keeps a local Map<topic, subscribers> and gossip-replicates the topic→node set so Publish can reach every subscriber with at most one remote hop.

Simple delta model: each mediator periodically gossips its local topic set to one random peer. Peers merge into their view.

new DistributedPubSubMediator(settings): DistributedPubSubMediator

Defined in: src/cluster/pubsub/DistributedPubSubMediator.ts:64

DistributedPubSubSettings

DistributedPubSubMediator

Actor.constructor

readonly settings: DistributedPubSubSettings

Defined in: src/cluster/pubsub/DistributedPubSubMediator.ts:64

onReceive(msg): void

Defined in: src/cluster/pubsub/DistributedPubSubMediator.ts:90

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

Subscribe | Unsubscribe | UnsubscribeAll | GetTopics | PubSubPublishMsg | Publish<unknown>

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(): void

Defined in: src/cluster/pubsub/DistributedPubSubMediator.ts:84

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

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

Subscribe | Unsubscribe | UnsubscribeAll | GetTopics | PubSubPublishMsg | Publish<unknown>

void | Promise<void>

Actor.preRestart


preStart(): void

Defined in: src/cluster/pubsub/DistributedPubSubMediator.ts:66

Called after construction and before the first message is processed.

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