Interface QueueHandle

    Per-queue handle returned by @InjectQueue(name). Wraps the global Eddyq client and pre-binds the queue name + per-queue defaults so call sites don't need to repeat them.

    interface QueueHandle {
        name: string;
        clean(
            graceMs: number,
            limit: number,
            state: "completed" | "failed" | "cancelled",
        ): Promise<number>;
        enqueue(
            kind: string,
            payload: unknown,
            options?: QueueEnqueueOptions,
        ): Promise<EnqueueOutcome>;
        enqueueBatch(input: QueueEnqueueBatchInput): Promise<BatchEnqueueOutcome>;
        enqueueMany(items: QueueEnqueueManyItem[]): Promise<BulkEnqueueOutcome>;
        group(groupKey: string, profile: string | GroupProfile): GroupedQueueHandle;
    }
    Index

    Properties

    name: string

    The queue name this handle is bound to.

    Methods

    • Ad-hoc retention sweep. Deletes up to limit finalized jobs in state older than graceMs milliseconds. Useful for one-shot pruning from admin endpoints or maintenance scripts; routine retention should go through the configured cleanup tick instead.

      Note: this is a global sweep, not scoped to this handle's queue name — the underlying delete operates on state + finalized_at, not on queue. Run it from one designated handle if you need a single entry point.

      Parameters

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

      Returns Promise<number>

    • Enqueue one job onto this queue.

      Parameters

      Returns Promise<EnqueueOutcome>

    • Return a sub-handle pre-bound to a group key. The first call for a given (groupKey, profile) configures the group via setGroupConcurrency / setGroupRate and memoizes the result for the life of the process.

      profile may be a profile name registered on this queue (under registerQueue({ groups })) or an inline GroupProfile.

      Parameters

      Returns GroupedQueueHandle