Skip to content

EventStream

Defined in: src/EventStream.ts:35

new EventStream(): EventStream

EventStream

optional log?: EventStreamLogger

Defined in: src/EventStream.ts:44

Optional logger used to surface predicate failures. Assigned by ActorSystem once its main logger has been constructed; tests that instantiate EventStream directly can leave it undefined — the bus stays functional, errors just stay silent.

publish(event): void

Defined in: src/EventStream.ts:96

Publish an event to all matching subscribers.

object

void


subscribe<T>(subscriber, channel, predicate?): boolean

Defined in: src/EventStream.ts:57

Subscribe an actor ref to a channel (class). Returns true if a new subscription was added; false if a duplicate was rejected.

Dedup rules. Without predicate, only one subscription per (subscriber, channel) is kept — re-calling subscribe is a no-op. With a predicate, every call adds a new subscription: predicates are values without an identity contract, so dedup’ing across them would be unreliable; users wanting “replace this filter” should unsubscribe first.

T

ActorRef

Class<T>

(event) => boolean

boolean


unsubscribe<T>(subscriber, channel?): boolean

Defined in: src/EventStream.ts:83

Unsubscribe a (subscriber, channel) pair, or every subscription the actor holds when channel is omitted. Removes ALL matching entries — including predicate-bearing ones; finer-grained removal (one specific predicate at a time) isn’t supported because predicates have no stable identity.

T

ActorRef

Class<T>

boolean