Plugin Queues

Horizon — Queue Dashboard

Laravel-style queue dashboard: in-memory throughput stats, optional Redis-backed failed jobs, live Redis queue depths (pending / delayed / processing / in-flight), Prometheus metrics, and a configurable Gate for production.

§ Overview

  • Dashboard HTML under HORIZON_PATH (default /horizon).
  • Observer hooks increment global Prometheus counters (same registry as /metrics).
  • With Options.RedisURL (typically REDIS_URL): failed job persistence + Horizon UI for list / forget / retry.
  • Same Redis client powers live workloads on the Pending page and GET …/api/workloads using the same keys as queue.RedisAdapter.
  • HORIZON_QUEUES — comma-separated queue names to always include in workload snapshots (even before traffic hits the observer).

§ Installation

$ nimbus plugin:install horizon

Or register manually in bin/server.go:

import (
    "os"
    "github.com/CodeSyncr/nimbus/plugins/horizon"
)

app.Use(horizon.NewWithOptions(horizon.Options{
    RedisURL: os.Getenv("REDIS_URL"),
    Gate:     nil, // optional: func(*http.Context) bool
}))

§ Environment

Variable Purpose
HORIZON_PATHDashboard base path
HORIZON_ENABLEDSet true to allow the dashboard when APP_ENV=production
REDIS_URLPass into Options.RedisURL for failed store + live workloads
HORIZON_QUEUESExtra queue names for workload probes (comma-separated)

§ Worker config (horizon.Config)

Code-driven supervisors (environments, balance strategies, tries, timeout, backoff) live on github.com/CodeSyncr/nimbus/plugins/horizon. Pass a pointer via horizon.Options{ Config: &cfg } or use horizon.DefaultConfig(). Fields match Laravel-style naming: Environments, SupervisorConfig with Balance auto / simple / false, etc.

§ Failed jobs

When Redis is configured, the plugin registers queue.SetFailedJobStore. Failed jobs appear under Failed in the UI. From code, use queue.GetFailedJobStore() after boot (same interface the dashboard uses).

§ HTTP routes (relative to HORIZON_PATH)

Method Path Description
GET/Dashboard
GET/pendingPending + live Redis workloads (when Redis configured)
GET/api/metricsJSON stats snapshot
GET/api/workloadsRedis depth JSON (requires RedisURL)
GET/api/metrics/prometheusPrometheus text exposition
GET/api/failedList failed jobs (JSON)
POST/failed/:id/forgetForget one failed job
POST/failed/forget-allForget all
POST/failed/:id/retryRe-queue a failed job

§ Programmatic queue depths

Outside Horizon, use the core queue helper with a github.com/CodeSyncr/nimbus/redis client:

workloads, err := queue.RedisQueueWorkloads(ctx, rdb, []string{"default", "emails"})

See also: Queue, Production readiness, Reverb (WebSockets).