Skip to content

ChangeStreamHandlers

Defined in: libs/runtime/src/change-stream-client.ts:19

What a subscription calls as the hub’s stream delivers changes and as its own state changes.

Methods

Name Description
onActive()? Receiving changes from the hub.
onChange() Called with each change, in order.
onFailed()? 'transport' is the connection; 'apply' is onChange itself throwing.
onPaused()? Caught up — nothing further for now.

optional onActive(): void

Defined in: libs/runtime/src/change-stream-client.ts:28

Receiving changes from the hub.

void


onChange(record): void

Defined in: libs/runtime/src/change-stream-client.ts:24

Called with each change, in order. If it throws, the subscription stops without reconnecting and onFailed is called with 'apply'; the change is not counted as seen, so a resume starts at it.

ChangeRecord

void


optional onFailed(error, cause?): void

Defined in: libs/runtime/src/change-stream-client.ts:35

'transport' is the connection; 'apply' is onChange itself throwing.

They are not the same failure and must not be retried the same way — a transport error is worth reconnecting through, while a handler that throws will throw again on the identical record.

Error

"transport" | "apply"

void


optional onPaused(): void

Defined in: libs/runtime/src/change-stream-client.ts:26

Caught up — nothing further for now. Not a terminal state.

void

TypeDBLite is an independent open-source project, built on TypeDB with thanks. It is not affiliated with, sponsored by, or endorsed by TypeDB Ltd. Released under the MPL-2.0 license.