Skip to content

Interface: PostgresTopicBusOptions

Construction options for PostgresTopicBus.

optional channel?: unknown

What identifies this channel - anything, not just an identifier: a name, an id, a [env, feature] pair, a config object. The parts are tokenized into a legal Postgres channel name with a short hash of the originals appended, so the derivation is deterministic and no call site has to sanitize. See PostgresTopicBus.channelName for the resolved name.

One value or many: an array is read as multiple parts (object.OneOrMany), anything else as a single part. So ["billing", "prod"] and "billing_prod" are different channels, since the hash sees different structure.

Every participating process must pass EQUIVALENT parts, since a different spelling hashes to a different channel. Defaults to a shared dbx_tools_topic_bus channel.


optional metadata?: TopicMetadata | TopicMetadataProvider

Extra context added to every message this bus publishes, either a fixed record or a TopicMetadataProvider called per broadcast. Overrides automatic machine keys; per-call metadata overrides this.


optional onError?: (cause) => void

Sink for failures that have no caller to throw to: a listener that rejected, a dropped notification connection, a failed reconnect attempt. Defaults to swallowing them, so wire this to a logger in anything long-running.

unknown

void


optional persist?: boolean | TopicBusPersistenceOptions