Skip to content

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? ​

MemoryOutboxStoreOptions = {}

Returns ​

MemoryOutboxStore

Methods ​

all() ​

> all(): Promise<OutboxEntry[]>

Defined in: events/src/outbox.ts:197

Returns ​

Promise<OutboxEntry[]>

Implementation of ​

OutboxStore.all


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 ​

OutboxClaimOptions

Returns ​

Promise&lt;string[]&gt;

Implementation of ​

OutboxStore.claim


enqueue() ​

> enqueue(input, _options?): Promise&lt;OutboxEntry&gt;

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? ​

OutboxStoreEnqueueOptions

Returns ​

Promise&lt;OutboxEntry&gt;

Implementation of ​

OutboxStore.enqueue


markFailed() ​

> markFailed(id, error, options?): Promise&lt;void&gt;

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? ​

OutboxMarkFailedOptions = {}

Returns ​

Promise&lt;void&gt;

Implementation of ​

OutboxStore.markFailed


markPublished() ​

> markPublished(id, at): Promise&lt;void&gt;

Defined in: events/src/outbox.ts:178

Marks an entry delivered (and releases its claim).

Parameters ​

id ​

string

at ​

number

Returns ​

Promise&lt;void&gt;

Implementation of ​

OutboxStore.markPublished


pending() ​

> pending(limit, maxAttempts, filter?): Promise&lt;OutboxEntry[]&gt;

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&lt;OutboxEntry[]&gt;

Implementation of ​

OutboxStore.pending

Released under the MIT License.