Skip to content

Epic: Queue-based trigger — internal task queue with push API #806

@geoffjay

Description

@geoffjay

Summary

Implement an internal task queue system that decouples task producers from consumers. External systems or other workflows push tasks onto named queues via API, and a QueueStrategy consumes them to trigger workflow dispatches. This pattern enables fan-out architectures, priority-based work distribution, and clean producer/consumer separation.

Goals

  • Implement a persistent internal task queue with SQLite-backed storage
  • Add POST /queues/{name}/push API endpoint for task submission
  • Implement QueueStrategy that consumes tasks from a named queue
  • Add Queue variant to TriggerConfig with queue name and optional batch size
  • Support FIFO ordering with optional priority levels
  • Wire into the strategy factory, API validation, and CLI

Design Notes

  • Queue storage should use the existing SeaORM/SQLite infrastructure in SchedulerStorage
  • Tasks in the queue are distinct from scheduler::Task — they carry a payload that gets converted to a Task on dequeue
  • Consider visibility timeout: tasks are invisible to other consumers while being processed, returned to queue on failure
  • Queue names are workflow-scoped or globally named (design decision needed)
  • The push API should be lightweight — no authentication beyond the standard API middleware
  • Batch consumption: QueueStrategy can dequeue one or more tasks per cycle
  • Dead letter queue (DLQ) for repeatedly failed tasks — may be deferred to a follow-up

Acceptance Criteria

  • Queue table added via SeaORM migration
  • POST /queues/{name}/push endpoint accepts task payloads
  • QueueStrategy implements TriggerStrategy trait
  • FIFO ordering guaranteed
  • Queue variant added to TriggerConfig
  • Strategy factory creates QueueStrategy from config
  • CLI commands for queue inspection (list, peek, purge)
  • Unit and integration tests
  • Documentation

Blocked By

Stack Base

Stack on: feature/autonomous-pipeline — this epic's issues can be worked in parallel with other Phase 6 epics.

Key Files

  • crates/orchestrator/src/scheduler/strategy.rs — add QueueStrategy
  • crates/orchestrator/src/scheduler/types.rs — add Queue variant
  • crates/orchestrator/src/scheduler/runner.rs — wire into create_strategy()
  • crates/orchestrator/src/scheduler/storage.rs — queue table and operations
  • crates/orchestrator/src/scheduler/api.rs — queue push endpoint

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions