SQLiteJobQueue
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:51
A job queue in a SQLite database.
With leaseMs, a processing job’s process_at holds its lease’s end, so
the table needs no new column. A job already processing without a lease,
taken by an earlier version or by a queue without leaseMs, cannot be
told from one whose lease has expired, so it is due at once.
Type Parameters
섹션 제목: “Type Parameters”T
Implements
섹션 제목: “Implements”JobQueue<T>
Constructors
섹션 제목: “Constructors”Constructor
섹션 제목: “Constructor”new SQLiteJobQueue<
T>(options?):SQLiteJobQueue<T>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:56
Parameters
섹션 제목: “Parameters”options?
섹션 제목: “options?”SQLiteJobQueueOptions<T> = {}
Returns
섹션 제목: “Returns”SQLiteJobQueue<T>
Methods
섹션 제목: “Methods”cleanupTerminal()
섹션 제목: “cleanupTerminal()”cleanupTerminal(
options?):Promise<number>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:435
Removes finished jobs: completed and failed ones by default, or those
with the given statuses, and with olderThan, only those that finished
before it.
Parameters
섹션 제목: “Parameters”options?
섹션 제목: “options?”JobQueueCleanupOptions | JobStatus[]
Returns
섹션 제목: “Returns”Promise<number>
Implementation of
섹션 제목: “Implementation of”clear()
섹션 제목: “clear()”clear():
Promise<void>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:426
Returns
섹션 제목: “Returns”Promise<void>
Implementation of
섹션 제목: “Implementation of”close()
섹션 제목: “close()”close():
void
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:466
Returns
섹션 제목: “Returns”void
complete()
섹션 제목: “complete()”complete(
jobId,_result?):Promise<void>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:277
Parameters
섹션 제목: “Parameters”jobId
섹션 제목: “jobId”string
_result?
섹션 제목: “_result?”any
Returns
섹션 제목: “Returns”Promise<void>
Implementation of
섹션 제목: “Implementation of”dequeue()
섹션 제목: “dequeue()”dequeue(
options?):Promise<Job<T> |undefined>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:212
Takes the next due job and, with leaseMs, leases it. Jobs whose lease
expired are due again first, or fail when they have no attempts left.
Parameters
섹션 제목: “Parameters”options?
섹션 제목: “options?”JobDequeueOptions = {}
Returns
섹션 제목: “Returns”Promise<Job<T> | undefined>
Implementation of
섹션 제목: “Implementation of”enqueue()
섹션 제목: “enqueue()”enqueue(
type,data,options?):Promise<Job<T>>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:155
Parameters
섹션 제목: “Parameters”type
섹션 제목: “type”string
data
섹션 제목: “data”T
options?
섹션 제목: “options?”delay?
섹션 제목: “delay?”number
maxAttempts?
섹션 제목: “maxAttempts?”number
metadata?
섹션 제목: “metadata?”Record<string, any>
priority?
섹션 제목: “priority?”number
Returns
섹션 제목: “Returns”Promise<Job<T>>
Implementation of
섹션 제목: “Implementation of”fail()
섹션 제목: “fail()”fail(
jobId,error,retry?):Promise<void>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:294
Counts a failed attempt: the job is due again after retry.delayMs when
retries are enabled and attempts are left, and fails otherwise. A
completed job stays completed, even for a worker whose lease expired.
Parameters
섹션 제목: “Parameters”jobId
섹션 제목: “jobId”string
error
섹션 제목: “error”string | Error
retry?
섹션 제목: “retry?”JobRetryDirective = ...
Returns
섹션 제목: “Returns”Promise<void>
Implementation of
섹션 제목: “Implementation of”getJob()
섹션 제목: “getJob()”getJob(
jobId):Promise<Job<T> |undefined>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:396
Parameters
섹션 제목: “Parameters”jobId
섹션 제목: “jobId”string
Returns
섹션 제목: “Returns”Promise<Job<T> | undefined>
Implementation of
섹션 제목: “Implementation of”nextDueAt()
섹션 제목: “nextDueAt()”nextDueAt():
Promise<Date|undefined>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:380
When dequeue() next has work: the earliest due time of a pending job
or, with leaseMs, lease expiry of a processing one. A time in the past
means dequeue() has work now, even when it only settles an expired
lease, so call dequeue() rather than checking size(). undefined
when no job is pending or leased.
Returns
섹션 제목: “Returns”Promise<Date | undefined>
Implementation of
섹션 제목: “Implementation of”peek()
섹션 제목: “peek()”peek():
Promise<Job<T> |undefined>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:341
The job dequeue() would take next, including one whose lease expired,
shown as it will be once it is due again. Changes nothing.
Returns
섹션 제목: “Returns”Promise<Job<T> | undefined>
Implementation of
섹션 제목: “Implementation of”remove()
섹션 제목: “remove()”remove(
jobId):Promise<boolean>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:412
Parameters
섹션 제목: “Parameters”jobId
섹션 제목: “jobId”string
Returns
섹션 제목: “Returns”Promise<boolean>
Implementation of
섹션 제목: “Implementation of”size()
섹션 제목: “size()”size():
Promise<number>
Defined in: packages/messaging/src/queue/sqlite-job-queue.ts:362
How many jobs are due now, including those whose lease expired.
Returns
섹션 제목: “Returns”Promise<number>