MonqueService
Defined in: tsed/src/services/monque-service.ts:51
Injectable service that wraps the Monque instance.
Exposes the full Monque public API through dependency injection.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Returns
Section titled “Returns”MonqueService
Accessors
Section titled “Accessors”monque
Section titled “monque”Get Signature
Section titled “Get Signature”Defined in: tsed/src/services/monque-service.ts:71
Access the underlying Monque instance.
Throws
Section titled “Throws”if MonqueModule is not initialized
Returns
Section titled “Returns”Monque
Methods
Section titled “Methods”cancelJob()
Section titled “cancelJob()”Defined in: tsed/src/services/monque-service.ts:144
Cancel a pending or scheduled job.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
jobId | string | The ID of the job to cancel |
Returns
Section titled “Returns”Promise<PersistedJob | null>
The cancelled job, or null if not found
cancelJobs()
Section titled “cancelJobs()”Defined in: tsed/src/services/monque-service.ts:200
Cancel multiple jobs matching the given filter.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
filter | JobSelector | Selector for which jobs to cancel |
Returns
Section titled “Returns”Promise<BulkOperationResult>
Result with count of cancelled jobs
deleteJob()
Section titled “deleteJob()”Defined in: tsed/src/services/monque-service.ts:186
Permanently delete a job.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
jobId | string | The ID of the job to delete |
Returns
Section titled “Returns”Promise<boolean>
true if deleted, false if job not found
deleteJobs()
Section titled “deleteJobs()”Defined in: tsed/src/services/monque-service.ts:220
Delete multiple jobs matching the given filter.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
filter | JobSelector | Selector for which jobs to delete |
Returns
Section titled “Returns”Promise<BulkOperationResult>
Result with count of deleted jobs
enqueue()
Section titled “enqueue()”Defined in: tsed/src/services/monque-service.ts:93
Enqueue a job for processing.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name | string | Job type identifier (use full namespaced name, e.g., “email.send”) |
data | T | Job payload |
options? | EnqueueOptions | Scheduling and deduplication options |
Returns
Section titled “Returns”Promise<PersistedJob<T>>
The created or existing job document
enqueueMany()
Section titled “enqueueMany()”Defined in: tsed/src/services/monque-service.ts:98
Enqueue a batch using full namespaced job names and per-job scheduling options.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
jobs | readonly EnqueueJob<unknown>[] |
options? | JobWriteOptions |
Returns
Section titled “Returns”Promise<EnqueueManyResult>
getJob()
Section titled “getJob()”Defined in: tsed/src/services/monque-service.ts:235
Get a job by its ID.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
jobId | string | ObjectId | The job’s ObjectId (as string or ObjectId) |
Returns
Section titled “Returns”Promise<PersistedJob<T> | null>
The job document, or null if not found
Throws
Section titled “Throws”if jobId is an invalid hex string
getJobs()
Section titled “getJobs()”Defined in: tsed/src/services/monque-service.ts:257
Query jobs from the queue with optional filters.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
filter? | GetJobsFilter | Optional filter criteria (name, status, limit, skip) |
Returns
Section titled “Returns”Promise<PersistedJob<T>[]>
Array of matching jobs
getJobsWithCursor()
Section titled “getJobsWithCursor()”Defined in: tsed/src/services/monque-service.ts:267
Get a paginated list of jobs using opaque cursors.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? | CursorOptions | Pagination options (cursor, limit, direction, filter) |
Returns
Section titled “Returns”Promise<CursorPage<T>>
Page of jobs with next/prev cursors
getProcessingState()
Section titled “getProcessingState()”Defined in: tsed/src/services/monque-service.ts:308
Identify and inspect the local scheduler’s global or named-worker pause state.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
Returns
Section titled “Returns”ProcessingState
getQueueStats()
Section titled “getQueueStats()”Defined in: tsed/src/services/monque-service.ts:277
Get aggregate statistics for the job queue.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
filter? | Pick<JobSelector, "name"> | Optional filter to scope statistics by job name |
Returns
Section titled “Returns”Promise<QueueStats>
Queue statistics
getQueueViewSummaries()
Section titled “getQueueViewSummaries()”Defined in: tsed/src/services/monque-service.ts:282
Read persisted queue counts and fresh local worker policies.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
filter? | Pick<JobSelector, "name"> |
Returns
Section titled “Returns”Promise<readonly QueueViewSummary[]>
isHealthy()
Section titled “isHealthy()”Defined in: tsed/src/services/monque-service.ts:317
Check if the scheduler is healthy and running.
Returns
Section titled “Returns”boolean
true if running and connected
isPaused()
Section titled “isPaused()”Defined in: tsed/src/services/monque-service.ts:303
Whether the local scheduler, or named worker, is effectively paused.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
Returns
Section titled “Returns”boolean
Defined in: tsed/src/services/monque-service.ts:112
Enqueue a job for immediate processing.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name | string | Job type identifier |
data | T | Job payload |
options? | NowOptions | - |
Returns
Section titled “Returns”Promise<PersistedJob<T>>
The created job document
pause()
Section titled “pause()”Defined in: tsed/src/services/monque-service.ts:293
Pause local executions, optionally for one fully qualified job name.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
Returns
Section titled “Returns”void
rescheduleJob()
Section titled “rescheduleJob()”Defined in: tsed/src/services/monque-service.ts:165
Reschedule a pending job to run at a different time.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
jobId | string | The ID of the job to reschedule |
runAt | Date | The new Date when the job should run |
Returns
Section titled “Returns”Promise<PersistedJob | null>
The updated job, or null if not found
resume()
Section titled “resume()”Defined in: tsed/src/services/monque-service.ts:298
Resume local executions without restarting the scheduler.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name? | string |
Returns
Section titled “Returns”void
retryJob()
Section titled “retryJob()”Defined in: tsed/src/services/monque-service.ts:154
Retry a failed or cancelled job.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
jobId | string | The ID of the job to retry |
Returns
Section titled “Returns”Promise<PersistedJob | null>
The updated job, or null if not found
retryJobs()
Section titled “retryJobs()”Defined in: tsed/src/services/monque-service.ts:210
Retry multiple jobs matching the given filter.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
filter | JobSelector | Selector for which jobs to retry |
Returns
Section titled “Returns”Promise<BulkOperationResult>
Result with count of retried jobs
schedule()
Section titled “schedule()”Defined in: tsed/src/services/monque-service.ts:125
Schedule a recurring job with a cron expression.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
cron | string | Cron expression (5-field standard or predefined like @daily) |
name | string | Job type identifier |
data | T | Job payload |
options? | ScheduleOptions | Scheduling options |
Returns
Section titled “Returns”Promise<PersistedJob<T>>
The created job document
setJobPriority()
Section titled “setJobPriority()”Defined in: tsed/src/services/monque-service.ts:176
Change a pending Job’s priority, including subsequent recurring runs.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
jobId | string | The ID of the pending Job |
priority | number | The new signed safe integer priority |
Returns
Section titled “Returns”Promise<PersistedJob | null>
The updated Job, or null for a missing or invalid identifier