MCP TypeScript SDK
    Preparing search index...

    Class InMemoryTaskMessageQueueExperimental

    A simple in-memory implementation of TaskMessageQueue for demonstration purposes.

    This implementation stores messages in memory, organized by task ID and optional session ID. Messages are stored in FIFO queues per task.

    Note: This is not suitable for production use in distributed systems. For production, consider implementing TaskMessageQueue with Redis or other distributed queues.

    Implements

    Index

    Constructors

    Methods

    • Experimental

      Removes and returns the first message from the queue for a specific task.

      Parameters

      • taskId: string

        The task identifier

      • OptionalsessionId: string

        Optional session ID for binding the query to a specific session

      Returns Promise<QueuedMessage | undefined>

      The first message, or undefined if the queue is empty

    • Experimental

      Adds a message to the end of the queue for a specific task. Atomically checks queue size and throws if maxSize would be exceeded.

      Parameters

      • taskId: string

        The task identifier

      • message: QueuedMessage

        The message to enqueue

      • OptionalsessionId: string

        Optional session ID for binding the operation to a specific session

      • OptionalmaxSize: number

        Optional maximum queue size - if specified and queue is full, throws an error

      Returns Promise<void>

      Error if maxSize is specified and would be exceeded