TaskBridgeStreamTransport

class TaskBridgeStreamTransport<Ctx>(baseUrl: String, context: Ctx, deps: TaskBridgeStreamTransportDeps<Ctx>, checkpoint: TaskBridgeCheckpointBinding<Ctx>, options: TaskBridgeStreamTransportOptions<Ctx> = TaskBridgeStreamTransportOptions())

Transport orchestrator for one observed task stream.

Lifecycle:

  1. Resolve the initial watermark from the explicit afterEventId, then persistent checkpoint storage.

  2. Observe via the configured fallback strategy: WebSocket first, then SSE, then long-polling.

  3. Deduplicate by eventId across transport failover and replay suffixes.

  4. Persist the latest delivered eventId after each successful emission.

  5. Clear the checkpoint after a terminal task event.

The collector helpers for WebSocket and SSE intentionally live in separate files so this type can focus on orchestration rules: sequencing, retry boundaries, deduplication, and checkpoint ownership.

Constructors

Link copied to clipboard
constructor(baseUrl: String, context: Ctx, deps: TaskBridgeStreamTransportDeps<Ctx>, checkpoint: TaskBridgeCheckpointBinding<Ctx>, options: TaskBridgeStreamTransportOptions<Ctx> = TaskBridgeStreamTransportOptions())

Functions

Link copied to clipboard
fun observeTaskEvents(taskId: String, afterEventId: String? = null): Flow<TaskEvent>

Returns a Flow of events for a specific task.