Skip to main content
Defined in: durability/journal.ts:232 OutboxJournal over a DurableKv.

Implements

Constructors

Constructor

Defined in: durability/journal.ts:234

Parameters

Returns

KvOutbox

Methods

put()

Defined in: durability/journal.ts:240 Insert-if-absent by key; on conflict the existing record is returned unchanged ('exists'). With lease, a new record is created already begun (sending, token 1, 1 attempt).

Parameters

Returns

Promise<{ status: "created" | "exists"; record: OutboxRecord; }>

Implementation of

OutboxJournal.put

begin()

Defined in: durability/journal.ts:262 pending/failed (due or not) → sending under a fresh token: the persisted “about to call the provider” marker. null when the record is missing or in another state.

Parameters

Returns

Promise<OutboxRecord | null>

Implementation of

OutboxJournal.begin

markSent()

Defined in: durability/journal.ts:276 sending → sent with the provider ref.

Parameters

Returns

Promise<void>

Throws

Implementation of

OutboxJournal.markSent

extend()

Defined in: durability/journal.ts:280 Extend the lease of a sending record (heartbeat while the provider call runs).

Parameters

Returns

Promise<void>

Throws

Implementation of

OutboxJournal.extend

markFailed()

Defined in: durability/journal.ts:284 sending → failed (due at retryAt) or dead. With refund, the claim made no provider call (a split part deferred behind an earlier one): the attempt it counted is given back, so waiting never uses up the record’s retries.

Parameters

Returns

Promise<void>

Throws

Implementation of

OutboxJournal.markFailed

claimDue()

Defined in: durability/journal.ts:293 Lease due pending/failed records and sending records whose lease expired (returned with ambiguous: true), oldest createdAt first. Claimed records come back sending under a fresh token.

Parameters

Returns

Promise<ClaimedSend[]>

Implementation of

OutboxJournal.claimDue

resolveAmbiguous()

Defined in: durability/journal.ts:320 Settle an ambiguous claim: 'unknown' (terminal) or 'pending' (send again).

Parameters

Returns

Promise<void>

Throws

Implementation of

OutboxJournal.resolveAmbiguous

get()

Defined in: durability/journal.ts:326

Parameters

Returns

Promise<OutboxRecord | undefined>

Implementation of

OutboxJournal.get

list()

Defined in: durability/journal.ts:331 Records, optionally by state and chat, oldest createdAt first.

Parameters

Returns

Promise<OutboxRecord[]>

Implementation of

OutboxJournal.list

retry()

Defined in: durability/journal.ts:338 Operator retry: failed/dead/unknown → pending, due now.

Parameters

Returns

Promise<void>

Implementation of

OutboxJournal.retry

discard()

Defined in: durability/journal.ts:344 Operator discard: delete the record (a later send with the same key goes out again).

Parameters

Returns

Promise<void>

Implementation of

OutboxJournal.discard

purge()

Defined in: durability/journal.ts:351 Delete terminal records completed before before. Returns the count.

Parameters

Returns

Promise<number>

Implementation of

OutboxJournal.purge