Task State Manager
class TaskStateManager
Manages task state and history for streaming and resubscription support. Tracks active tasks, completed tasks, and their event history.
Types
Link copied to clipboard
data class TaskInfo(val taskId: String, val contextId: String, val streamId: String, val events: MutableList<<Error class: unknown class>> = mutableListOf(), val createdAt: Instant = Instant.now(), var completedAt: Instant? = null, var currentState: <Error class: unknown class> = TaskState.WORKING)
Stores information about a task
Functions
Link copied to clipboard
Removes old completed tasks (basic cleanup)
Link copied to clipboard
Gets the stream ID associated with a task
Link copied to clipboard
Gets all events for a task
Link copied to clipboard
Gets the task info for a given task ID
Link copied to clipboard
Checks if a task is active
Link copied to clipboard
Records an event for a task
Link copied to clipboard
Registers a new task with its stream ID
Link copied to clipboard
Checks if a task exists (active or completed)
Link copied to clipboard
Updates the stream ID for a task (used during resubscription)