basalt / events/src / OutboxStore
Interface: OutboxStore
Defined in: events/src/outbox.ts:81
Methods
all()
> all(): Promise<OutboxEntry[]>
Defined in: events/src/outbox.ts:106
Returns
Promise<OutboxEntry[]>
claim()?
> optional claim(ids, options): Promise<string[]>
Defined in: events/src/outbox.ts:101
OPTIONAL — atomically claims the given entries for one relay, so several relays (replicas) sharing the store never dispatch the same entry at once. Claims only entries still unpublished whose previous claim expired (lockedUntil <= now, or none), stamps token and until on them, and returns the ids it won. Must be atomic across processes (a conditional UPDATE … WHERE lockedUntil IS NULL OR lockedUntil <= now). Stores without it are single-relay only.
Parameters
ids
string[]
options
Returns
Promise<string[]>
enqueue()
> enqueue(entry, options?): Promise<OutboxEntry>
Defined in: events/src/outbox.ts:86
Writes an entry. With options.tx the write joins that transaction (stores that support it) — commit both the state change and the event, or neither.
Parameters
entry
createdAt
number
event
string
id?
string
payload
unknown
tenantId?
string
options?
Returns
Promise<OutboxEntry>
markFailed()
> markFailed(id, error, options?): Promise<void>
Defined in: events/src/outbox.ts:105
Records a failed attempt (and releases its claim, or holds it until options.retryAt).
Parameters
id
string
error
string
options?
Returns
Promise<void>
markPublished()
> markPublished(id, at): Promise<void>
Defined in: events/src/outbox.ts:103
Marks an entry delivered (and releases its claim).
Parameters
id
string
at
number
Returns
Promise<void>
pending()
> pending(limit, maxAttempts, filter?): Promise<OutboxEntry[]>
Defined in: events/src/outbox.ts:91
Unpublished entries below the attempt ceiling (minus filter's tenants), oldest first.
Parameters
limit
number
maxAttempts
number
filter?
Returns
Promise<OutboxEntry[]>