Interface IPersistSessionInstance

Per-context session persistence instance interface. Scoped to a specific (strategyName, exchangeName, frameName) triple.

Used by SessionPersistInstance for crash-safe session storage. Custom adapters should implement this interface to override the default file-based session behavior.

interface IPersistSessionInstance {
    dispose(): void;
    readSessionData(): Promise<SessionData>;
    waitForInit(initial: boolean): Promise<void>;
    writeSessionData(data: SessionData, when: Date): Promise<void>;
}

Implemented by

Methods

  • Release any resources held by this instance. Default implementations may treat this as a no-op.

    Returns void

  • Read persisted session data for this context.

    Returns Promise<SessionData>

    Promise resolving to session data or null if none persisted

  • Initialize storage for this session context.

    Parameters

    • initial: boolean

      Whether this is the first initialization

    Returns Promise<void>

    Promise that resolves when initialization is complete

  • Write session data for this context.

    Parameters

    • data: SessionData

      Session data to persist (already carries data.when)

    • when: Date

      Logical timestamp this value belongs to (duplicates data.when for API consistency)

    Returns Promise<void>

    Promise that resolves when write is complete