@codesoul-co/hypha-core / modules/runtime/session-queue
- Package index:
@codesoul-co/hypha-core - Source:
packages/core/src/modules/runtime/session-queue.ts - Exports: 4
Using this module
Use the Session queue module for executing runtime behavior at this boundary. It exports 1 class, 1 function, 2 interfaces.
Import from the package entrypoint
ts
import {
InMemorySessionQueue,
createSessionQueueHealthSnapshot,
} from '@codesoul-co/hypha-core';
import type {
InMemorySessionQueueOptions,
SessionQueue,
} from '@codesoul-co/hypha-core';Usage patterns
- Use the 2 type/interface exports as static contracts in application code, adapters, or tests. Import them with
import type; they do not exist at runtime. - The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
- The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
InMemorySessionQueue | class | new InMemorySessionQueue(options?: InMemorySessionQueueOptions): InMemorySessionQueue | In Memory Session Queue class with 14 public constructor or member entries; its exact declarations are listed below. |
createSessionQueueHealthSnapshot | function | createSessionQueueHealthSnapshot(records: readonly SessionCommandRecord[], checkedAt: string, recoveredExpiredLeases?: number): SessionQueueHealthSnapshot | Create Session Queue Health Snapshot function with 1 public call signature; parameters and return types are listed below. |
InMemorySessionQueueOptions | interface | interface InMemorySessionQueueOptions | In Memory Session Queue Options interface with 8 public fields or methods. |
SessionQueue | interface | interface SessionQueue | Session Queue interface with 13 public fields or methods. |
InMemorySessionQueue
In Memory Session Queue class with 14 public constructor or member entries; its exact declarations are listed below.
- Kind: class
- Import:
import { InMemorySessionQueue } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/session-queue
Declaration
text
export declare class InMemorySessionQueue implements SessionQueue {
constructor(options?: InMemorySessionQueueOptions);
enqueue(request: EnqueueSessionCommandRequest): Promise<SessionCommandRecord>;
claim(request: ClaimSessionCommandRequest): Promise<SessionCommandRecord | null>;
renew(request: RenewSessionCommandRequest): Promise<SessionCommandClaim>;
complete(request: CompleteSessionCommandRequest): Promise<void>;
fail(request: FailSessionCommandRequest): Promise<void>;
release(request: ReleaseSessionCommandRequest): Promise<void>;
list(request: ListSessionCommandsRequest): Promise<SessionCommandRecord[]>;
cancelPending(request: CancelSessionCommandsRequest): Promise<CancelSessionCommandsResult>;
redriveDeadLetter(request: RedriveDeadLetterSessionCommandRequest): Promise<SessionCommandRecord>;
closeDeadLetter(request: CloseDeadLetterSessionCommandRequest): Promise<SessionCommandRecord>;
listStuck(request: ListStuckSessionCommandsRequest): Promise<StuckSessionCommand[]>;
drain(scope: SessionQueueScope): Promise<void>;
health(): Promise<ProviderHealth & {
details: SessionQueueHealthSnapshot;
}>;
}Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
cancelPending | method | cancelPending(request: CancelSessionCommandsRequest): Promise<CancelSessionCommandsResult> | Public method; parameters and return type are shown in the signature. |
claim | method | claim(request: ClaimSessionCommandRequest): Promise<SessionCommandRecord | null> | Public method; parameters and return type are shown in the signature. |
closeDeadLetter | method | closeDeadLetter(request: CloseDeadLetterSessionCommandRequest): Promise<SessionCommandRecord> | Public method; parameters and return type are shown in the signature. |
complete | method | complete(request: CompleteSessionCommandRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
constructor | constructor | (options?: InMemorySessionQueueOptions): InMemorySessionQueue | Creates an instance of this class. |
drain | method | drain(scope: SessionQueueScope): Promise<void> | Public method; parameters and return type are shown in the signature. |
enqueue | method | enqueue(request: EnqueueSessionCommandRequest): Promise<SessionCommandRecord> | Public method; parameters and return type are shown in the signature. |
fail | method | fail(request: FailSessionCommandRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
health | method | health(): Promise<ProviderHealth & { details: SessionQueueHealthSnapshot; }> | Public method; parameters and return type are shown in the signature. |
list | method | list(request: ListSessionCommandsRequest): Promise<SessionCommandRecord[]> | Public method; parameters and return type are shown in the signature. |
listStuck | method | listStuck(request: ListStuckSessionCommandsRequest): Promise<StuckSessionCommand[]> | Public method; parameters and return type are shown in the signature. |
redriveDeadLetter | method | redriveDeadLetter(request: RedriveDeadLetterSessionCommandRequest): Promise<SessionCommandRecord> | Public method; parameters and return type are shown in the signature. |
release | method | release(request: ReleaseSessionCommandRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
renew | method | renew(request: RenewSessionCommandRequest): Promise<SessionCommandClaim> | Public method; parameters and return type are shown in the signature. |
createSessionQueueHealthSnapshot
Create Session Queue Health Snapshot function with 1 public call signature; parameters and return types are listed below.
- Kind: function
- Import:
import { createSessionQueueHealthSnapshot } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/session-queue
Declaration
text
export declare function createSessionQueueHealthSnapshot(records: readonly SessionCommandRecord[], checkedAt: string, recoveredExpiredLeases?: number): SessionQueueHealthSnapshot;Call signature
text
createSessionQueueHealthSnapshot(records: readonly SessionCommandRecord[], checkedAt: string, recoveredExpiredLeases?: number): SessionQueueHealthSnapshotParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
records | readonly SessionCommandRecord[] | Yes | Required parameter; accepted values are defined by the type column. |
checkedAt | string | Yes | Required parameter; accepted values are defined by the type column. |
recoveredExpiredLeases | number | No | Optional parameter; accepted values are defined by the type column. |
Returns
- Type:
SessionQueueHealthSnapshot - Description: The return contract is defined by the type shown above.
InMemorySessionQueueOptions
In Memory Session Queue Options interface with 8 public fields or methods.
- Kind: interface
- Import:
import type { InMemorySessionQueueOptions } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/session-queue
Declaration
text
export interface InMemorySessionQueueOptions {
now?: () => string;
duplicatePolicy?: 'reuse' | 'reject';
maxPendingPerSession?: number;
maxPendingPerUser?: number;
maxPendingGlobal?: number;
maxConcurrentSessions?: number;
maxConcurrentSessionsPerUser?: number;
priorityAgingMs?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
duplicatePolicy | property | duplicatePolicy?: "reuse" | "reject" | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxConcurrentSessions | property | maxConcurrentSessions?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxConcurrentSessionsPerUser | property | maxConcurrentSessionsPerUser?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxPendingGlobal | property | maxPendingGlobal?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxPendingPerSession | property | maxPendingPerSession?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
maxPendingPerUser | property | maxPendingPerUser?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
now | method | now?(): string | Public method; parameters and return type are shown in the signature. |
priorityAgingMs | property | priorityAgingMs?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
SessionQueue
Session Queue interface with 13 public fields or methods.
- Kind: interface
- Import:
import type { SessionQueue } from '@codesoul-co/hypha-core'; - Source module:
modules/runtime/session-queue
Declaration
text
export interface SessionQueue {
enqueue(request: EnqueueSessionCommandRequest): Promise<SessionCommandRecord>;
claim(request: ClaimSessionCommandRequest): Promise<SessionCommandRecord | null>;
renew(request: RenewSessionCommandRequest): Promise<SessionCommandClaim>;
complete(request: CompleteSessionCommandRequest): Promise<void>;
fail(request: FailSessionCommandRequest): Promise<void>;
release(request: ReleaseSessionCommandRequest): Promise<void>;
list(request: ListSessionCommandsRequest): Promise<SessionCommandRecord[]>;
cancelPending(request: CancelSessionCommandsRequest): Promise<CancelSessionCommandsResult>;
redriveDeadLetter(request: RedriveDeadLetterSessionCommandRequest): Promise<SessionCommandRecord>;
closeDeadLetter(request: CloseDeadLetterSessionCommandRequest): Promise<SessionCommandRecord>;
listStuck(request: ListStuckSessionCommandsRequest): Promise<StuckSessionCommand[]>;
drain(scope: SessionQueueScope): Promise<void>;
health(): Promise<ProviderHealth & {
details: SessionQueueHealthSnapshot;
}>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
cancelPending | method | cancelPending(request: CancelSessionCommandsRequest): Promise<CancelSessionCommandsResult> | Public method; parameters and return type are shown in the signature. |
claim | method | claim(request: ClaimSessionCommandRequest): Promise<SessionCommandRecord | null> | Public method; parameters and return type are shown in the signature. |
closeDeadLetter | method | closeDeadLetter(request: CloseDeadLetterSessionCommandRequest): Promise<SessionCommandRecord> | Public method; parameters and return type are shown in the signature. |
complete | method | complete(request: CompleteSessionCommandRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
drain | method | drain(scope: SessionQueueScope): Promise<void> | Public method; parameters and return type are shown in the signature. |
enqueue | method | enqueue(request: EnqueueSessionCommandRequest): Promise<SessionCommandRecord> | Public method; parameters and return type are shown in the signature. |
fail | method | fail(request: FailSessionCommandRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
health | method | health(): Promise<ProviderHealth & { details: SessionQueueHealthSnapshot; }> | Public method; parameters and return type are shown in the signature. |
list | method | list(request: ListSessionCommandsRequest): Promise<SessionCommandRecord[]> | Public method; parameters and return type are shown in the signature. |
listStuck | method | listStuck(request: ListStuckSessionCommandsRequest): Promise<StuckSessionCommand[]> | Public method; parameters and return type are shown in the signature. |
redriveDeadLetter | method | redriveDeadLetter(request: RedriveDeadLetterSessionCommandRequest): Promise<SessionCommandRecord> | Public method; parameters and return type are shown in the signature. |
release | method | release(request: ReleaseSessionCommandRequest): Promise<void> | Public method; parameters and return type are shown in the signature. |
renew | method | renew(request: RenewSessionCommandRequest): Promise<SessionCommandClaim> | Public method; parameters and return type are shown in the signature. |
