Skip to content

Function: registerMemorySessionEventStorage()

Makaio Framework


Makaio Framework / services-core / registerMemorySessionEventStorage

Function: registerMemorySessionEventStorage()

Section titled “Function: registerMemorySessionEventStorage()”

registerMemorySessionEventStorage(bus): () => void

Defined in: ../../../packages/services/core/src/session/session-events/memory-handler.ts:229

Register in-memory session event storage handlers.

Suitable for development, testing, and single-instance deployments. Data is lost when the process exits.

Events are stored per-session in insertion order. Cursor-based pagination uses a stable, monotonically-increasing sequence ID (seqIdByEventId) assigned at append time — semantically equivalent to the Drizzle handler’s auto-increment id column. Cursors survive concurrent appends and remain meaningful after deletes: an after cursor simply skips all events whose seqId is ≤ the cursor value, regardless of whether the referenced event still exists.

IMakaioBus

The bus instance to register handlers on

Cleanup function to unsubscribe all handlers

() => void

import { registerMemorySessionEventStorage } from '@makaio/services-core/session';
const cleanup = registerMemorySessionEventStorage(bus);
// Later, when shutting down:
cleanup();