jobqueue

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package jobqueue provides a standalone job queue. Jobs are enqueued via CLI and executed as workflows. The plugin adds a task_queue table, HTTP endpoints for job CRUD, a CLI enqueue command, and a background worker that polls for pending jobs and logs dispatch events (actual workflow dispatch comes later).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() plugin.Plugin

New creates a new Plugin instance.

Types

type JobResponse

type JobResponse struct {
	JobID       uuid.UUID       `json:"job_id"`
	QueueName   string          `json:"queue_name"`
	Status      string          `json:"status"`
	Payload     json.RawMessage `json:"payload"`
	CreatedAt   time.Time       `json:"created_at"`
	StartedAt   *time.Time      `json:"started_at,omitempty"`
	CompletedAt *time.Time      `json:"completed_at,omitempty"`
}

JobResponse is the JSON shape returned for a single job.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements a standalone job queue with tenant isolation.

func (*Plugin) Info

func (p *Plugin) Info() plugin.PluginInfo

Info returns plugin metadata for discovery and documentation.

func (*Plugin) Init

func (p *Plugin) Init(ctx context.Context, env *plugin.Environment) error

Init initializes the plugin with the given environment.

func (*Plugin) Migrations

func (p *Plugin) Migrations() []plugin.Migration

Migrations returns the database schema for the job queue. Tables are idempotent (IF NOT EXISTS) and safe to run multiple times.

func (*Plugin) RegisterCommands

func (p *Plugin) RegisterCommands() []plugin.Command

RegisterCommands returns CLI subcommands for the job queue.

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(mux *http.ServeMux) error

RegisterRoutes registers the job queue HTTP handlers on the given mux.

func (*Plugin) Run

func (p *Plugin) Run(ctx context.Context) error

Run starts the background worker goroutine. It polls the task_queue for pending jobs and runs a periodic reaper to unstuck jobs left running by crashed workers. Returns when ctx is cancelled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL