Skip to main content

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