basalt / events/src / MemoryOutboxStore
Class: MemoryOutboxStore
Defined in: events/src/outbox.ts:118
Implements
Constructors
Constructor
> new MemoryOutboxStore(options?): MemoryOutboxStore
Defined in: events/src/outbox.ts:126
Parameters
options?
Returns
MemoryOutboxStore
Methods
all()
> all(): Promise<OutboxEntry[]>
Defined in: events/src/outbox.ts:197
Returns
Promise<OutboxEntry[]>
Implementation of
claim()
> claim(ids, options): Promise<string[]>
Defined in: events/src/outbox.ts:161
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[]>
Implementation of
enqueue()
> enqueue(input, _options?): Promise<OutboxEntry>
Defined in: events/src/outbox.ts:131
options.tx is accepted and ignored: memory has no transactions (use a database store in production).
Parameters
input
createdAt
number
event
string
id?
string
payload
unknown
tenantId?
string
_options?
Returns
Promise<OutboxEntry>
Implementation of
markFailed()
> markFailed(id, error, options?): Promise<void>
Defined in: events/src/outbox.ts:187
Records a failed attempt (and releases its claim, or holds it until options.retryAt).
Parameters
id
string
error
string
options?
Returns
Promise<void>
Implementation of
markPublished()
> markPublished(id, at): Promise<void>
Defined in: events/src/outbox.ts:178
Marks an entry delivered (and releases its claim).
Parameters
id
string
at
number
Returns
Promise<void>
Implementation of
pending()
> pending(limit, maxAttempts, filter?): Promise<OutboxEntry[]>
Defined in: events/src/outbox.ts:149
Unpublished entries below the attempt ceiling (minus filter's tenants), oldest first.
Parameters
limit
number
maxAttempts
number
filter?
OutboxPendingFilter = {}
Returns
Promise<OutboxEntry[]>