Class EddyqApp

    Index

    Constructors

    Accessors

    • get hasPostgres(): boolean

      Whether this app has a Postgres backend configured. Lets callers decide whether to call PG-only methods (migrate, enqueueBatch).

      Returns boolean

    • get hasRedis(): boolean

      Whether this app has a Redis backend configured.

      Returns boolean

    Methods

    • Interval-style schedule. Supported on both Postgres and Redis since the schedule_intervals migration landed.

      Parameters

      • provider: string
      • name: string
      • intervalMs: number
      • kind: string
      • payload: any
      • Optionalpriority: number | null
      • OptionalmaxAttempts: number | null
      • Optionalqueue: string | null

      Returns Promise<void>

    • Parameters

      • provider: string
      • name: string
      • cron: string
      • kind: string
      • payload: any
      • Optionalpriority: number | null
      • OptionalmaxAttempts: number | null
      • Optionalqueue: string | null

      Returns Promise<void>

    • Cancel a pending job. The caller must specify which provider owns the id — job ids are not globally unique across backends.

      Parameters

      • id: number
      • provider: string

      Returns Promise<boolean>

    • Ad-hoc retention sweep. The caller specifies which provider to clean — retention is a backend-local notion.

      Parameters

      • graceMs: number
      • limit: number
      • state: "completed" | "failed" | "cancelled"
      • provider: string

      Returns Promise<number>

    • Parameters

      • provider: string
      • groupKey: string

      Returns Promise<void>

    • Close the Postgres pool (no-op when no PG backend).

      Returns Promise<void>

    • Enqueue a job. The target backend is picked from options.queue via the route table — falling back to defaultProvider when the queue isn't in the table.

      Parameters

      Returns Promise<EnqueueOutcome>

    • Bulk-enqueue with per-item routing. Items are grouped by their resolved provider (per options.queue → routes → defaultProvider), then dispatched to each backend in a single enqueueMany call. The returned counts are the sum across both backends.

      Mixed batches across backends are supported in one call — useful for fan-in jobs where some children land on Redis (e.g. webhook delivery) and some on Postgres (e.g. ledger write).

      Parameters

      Returns Promise<BulkEnqueueOutcome>

    • Per-backend job-state snapshot. Same shape as the standalone Eddyq.getStats / EddyqRedis.getStats — just scoped to one backend so the dashboard can render each half independently.

      Parameters

      • provider: string

      Returns Promise<JobStats>

    • Parameters

      • provider: string

      Returns Promise<Group[]>

    • Paginated job listing. Routes by filter.queue if set, otherwise uses the default provider. Pagination doesn't compose across two backends — callers wanting cross-backend results should issue two separate calls and stitch UI-side.

      Parameters

      Returns Promise<JobList>

    • Per-backend listJobs. Same shape as the routed listJobs — just scoped to one backend so a dashboard can fetch each half and stitch results UI-side (sort by createdAt, sum the totals).

      Parameters

      Returns Promise<JobList>

    • Per-backend named-queue listing. Dashboards typically render one list per backend (since queue names aren't globally unique across backends — they can collide deliberately or accidentally).

      Parameters

      • provider: string

      Returns Promise<NamedQueue[]>

    • Parameters

      • provider: string

      Returns Promise<Schedule[]>

    • Apply pending Postgres migrations (no-op when no PG backend). Mirrors Eddyq.migrate so the Nest module can call it uniformly.

      Returns Promise<MigrateReport | null>

    • Migration status for the Postgres backend (no-op when no PG backend).

      Returns Promise<MigrationStatus[]>

    • Parameters

      • provider: string
      • groupKey: string

      Returns Promise<void>

    • Parameters

      • provider: string
      • queue: string

      Returns Promise<void>

    • Which backend a queue routes to. Returns "postgres" or "redis" based on the routing table + defaultProvider. Useful when callers need to pick provider-specific paths (e.g. NestJS @InjectQueue handles dispatching admin calls correctly).

      Parameters

      • queueName: string

      Returns string

    • Parameters

      • provider: string
      • name: string

      Returns Promise<boolean>

    • Parameters

      • provider: string
      • groupKey: string

      Returns Promise<void>

    • Parameters

      • provider: string
      • queue: string

      Returns Promise<void>

    • Register the abort-broadcast handler. lib.cjs uses this to fan out shutdown to in-flight AbortControllers. Stored on the EddyqApp itself — fired once at the start of shutdown(), before either inner backend drains, so handlers see the signal regardless of which backend they're running on.

      Parameters

      • handler: (reason: string) => void

      Returns void

    • Parameters

      • provider: string
      • groupKey: string
      • max: number

      Returns Promise<void>

    • Parameters

      • provider: string
      • groupKey: string
      • count: number
      • periodMs: number

      Returns Promise<void>

    • Parameters

      • provider: string
      • queue: string
      • max: number

      Returns Promise<void>

    • Set worker concurrency on both backends.

      Parameters

      • n: number

      Returns void

    • Drain both runtimes. Mode and timeout apply to both in sequence.

      Parameters

      Returns Promise<void>

    • Start both backends' worker runtimes. Tuning options apply to both.

      Parameters

      Returns Promise<void>

    • Subscribe each backend's worker pool to the queues that route to it. The first time this is called the routes from connect() take effect; subsequent calls let runtime callers (e.g. NestJS dynamic queue registration) extend the subscribed set.

      Parameters

      • queues: string[]

      Returns void

    • Reconcile the schedule list against one provider's backend. The declared entries are upserted, anything not in the list is deleted. Idempotent — safe to run on every boot. Useful when schedules are declared in module config and the caller wants to keep them in sync.

      Parameters

      Returns Promise<SyncSchedulesReport>

    • Register a handler for kind. The same handler is registered on every configured backend — only the backend that actually fetches a job of this kind (per its subscribeTo) will invoke it.

      Parameters

      • kind: string
      • handler: (call: JobCall) => Promise<unknown>

      Returns void

    • Construct + connect both backends. queues declares the routing table (queue name → "postgres" | "redis"). Unrouted queue names fall back to defaultProvider; if that's omitted, the only configured backend wins.

      Parameters

      Returns Promise<EddyqApp>