Skip to content

Interface: TopicMessage\<TBody\>

The wire envelope every subscriber receives, and what PostgresTopicBus.broadcast returns to the publisher.

id, topic, and publishedAt are assigned by the bus; type, metadata, and body come from the caller (with automatic context merged under metadata). The shape is stable enough to hand straight to an SSE data: frame.

TBody extends SerializableValue = SerializableValue

body: TBody

The caller’s payload, unchanged.


id: string

Per-message identity generated by the publisher, unique across instances. Suitable for dedupe when a client reconnects and for an SSE id: field. Not ordered, and not a database key.


metadata: TopicMetadata

Automatic context merged with caller metadata. See TopicMetadata.


publishedAt: string

ISO-8601 publish time from the PUBLISHING process’s clock, not the database’s. Fine for display; do not order messages from different instances by it.


topic: string

The topic this was broadcast on; listeners on other topics never see it.


type: string

Caller-chosen event name, e.g. order.updated. Never empty.