cap-nodejs

CAP Node.js API


CAP Node.js API / cap-nest/src / ITransactionalPublishStorage

Interface: ITransactionalPublishStorage

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:105

Extends

Methods

claimUnpublished()

claimUnpublished(options): Promise<CapPublishEvent<JsonValue>[]>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:66

Atomically claim ready rows for one dispatcher instance.

Parameters

options

ClaimUnpublishedOptions

Returns

Promise<CapPublishEvent<JsonValue>[]>

Inherited from

IPublishStorage.claimUnpublished


findPublishById()?

optional findPublishById(id): Promise<CapPublishEvent<JsonValue> | undefined>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:91

Optional: find a published record by id (dashboard helpers)

Parameters

id

string

Returns

Promise<CapPublishEvent<JsonValue> | undefined>

Inherited from

IPublishStorage.findPublishById


initialize()?

optional initialize(options?): Promise<void>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:63

Optional one-time initialization: create schema/tables if needed

Parameters

options?

InitOptions

Returns

Promise<void>

Inherited from

IPublishStorage.initialize


listPublish()?

optional listPublish(opts): Promise<{ items: CapPublishEvent<JsonValue>[]; total?: number; }>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:94

Optional: paginated listing for dashboards and admin UIs

Parameters

opts
limit?

number

offset?

number

onlyUnpublished?

boolean

topic?

string

Returns

Promise<{ items: CapPublishEvent<JsonValue>[]; total?: number; }>

Inherited from

IPublishStorage.listPublish


markPublished()

markPublished(id, publishedAt?, ownership?): Promise<boolean | void>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:71

Mark record as successfully emitted to the broker.

Parameters

id

string

publishedAt?

Date

ownership?

PublishClaimOwnership

Returns

Promise<boolean | void>

Inherited from

IPublishStorage.markPublished


markPublishFailed()

markPublishFailed(id, error, options): Promise<boolean | void>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:78

Mark record as retryable failed, or dead-letter when retry limit is exceeded.

Parameters

id

string

error

unknown

options

MarkPublishFailedOptions

Returns

Promise<boolean | void>

Inherited from

IPublishStorage.markPublishFailed


releaseExpiredClaims()

releaseExpiredClaims(now): Promise<void>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:88

Release processing rows whose lease has expired.

Parameters

now

Date

Returns

Promise<void>

Inherited from

IPublishStorage.releaseExpiredClaims


renewPublishClaim()?

optional renewPublishClaim(options): Promise<boolean>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:85

Optional: extend an unexpired claim still owned by the expected token.

Parameters

options

RenewPublishClaimOptions

Returns

Promise<boolean>

Inherited from

IPublishStorage.renewPublishClaim


savePublish()

savePublish<T>(evt, ctx?): Promise<string>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:57

Insert a fresh outbox record and return its DB id

Type Parameters

T

T extends JsonValue = JsonValue

Parameters

evt

CapPublishEvent<T>

ctx?

CapOperationContext<unknown>

Returns

Promise<string>

Inherited from

IPublishStorage.savePublish


savePublishWithTx()

savePublishWithTx<T>(evt, tx): Promise<string>

Defined in: cap-nest/src/cap/abstractions/storage.interface.ts:109

Type Parameters

T

T extends JsonValue = JsonValue

Parameters

evt

CapPublishEvent<T>

tx

unknown

Returns

Promise<string>

Deprecated

Use savePublish(event, { tx }) instead.