Skip to main content
Version: Current

ReceiverBuilder

@rotorsoft/act-root


@rotorsoft/act-root / act-ops/src/receiver / ReceiverBuilder

Type Alias: ReceiverBuilder

ReceiverBuilder = object

Defined in: libs/act-ops/src/receiver/port.ts:74

Fluent builder for a Receiver. Matches Act's builder pattern: factories return a builder, builder methods register configuration, .build() finalizes and produces the immutable runtime artifact.

The type-level split between builder (on, build) and receiver (listen, close, fetch) means operators can't accidentally call .on() on a running receiver — registration and runtime are different lifecycle phases enforced at compile time.

Methods​

build()​

build(): Receiver

Defined in: libs/act-ops/src/receiver/port.ts:96

Finalize the configuration and produce the runtime Receiver. After .build(), no more handlers can be registered.

Returns​

Receiver


on()​

on<T>(name, schema, handler): ReceiverBuilder

Defined in: libs/act-ops/src/receiver/port.ts:86

Register a typed handler for a named event. The receiver validates the inbound body (or the transport's payload shape) with schema before calling handler — so the handler sees a fully-typed event, never raw bytes. Returns this for fluent chaining.

For the HTTP adapter, handlers are mounted at POST /<name>. Bus adapters dispatch based on a topic-encoded name; the convention is per-transport.

Type Parameters​

T​

T

Parameters​

name​

string

schema​

Validator<T>

handler​

(event, ctx) => Promise<void>

Returns​

ReceiverBuilder