Skip to main content
Version: Current

withBroker

@rotorsoft/act-root


@rotorsoft/act-root / act-notify / withBroker

Function: withBroker()

withBroker<S>(store, broker): S & object

Defined in: libs/act-notify/src/with-broker.ts:66

Wrap a durable store so commits publish wakeup hints to the broker and notify subscribes to it โ€” leaving every other Store method, and therefore every durability/lease/ordering guarantee, untouched.

The wrapped store's own notify (if any) is shadowed, not exercised: construct the base adapter with its native channel disabled (e.g. new PostgresStore({ notify: false })) to avoid paying for both.

Publish failures are swallowed and logged โ€” a broker outage degrades cross-process latency to the poll cycle, never a commit.

Type Parametersโ€‹

Sโ€‹

S extends Store

Parametersโ€‹

storeโ€‹

S

The durable adapter that remains the source of truth

brokerโ€‹

Broker

The wakeup channel (fan-out)

Returnsโ€‹

S & object

A store of the same shape with broker-backed notifications