Skip to content

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.

new MonqueService(): MonqueService;

MonqueService

get monque(): Monque;

Defined in: tsed/src/services/monque-service.ts:71

Access the underlying Monque instance.

if MonqueModule is not initialized

Monque

cancelJob(jobId): Promise<PersistedJob | null>;

Defined in: tsed/src/services/monque-service.ts:144

Cancel a pending or scheduled job.

ParameterTypeDescription
jobIdstringThe ID of the job to cancel

Promise<PersistedJob | null>

The cancelled job, or null if not found


cancelJobs(filter): Promise<BulkOperationResult>;

Defined in: tsed/src/services/monque-service.ts:200

Cancel multiple jobs matching the given filter.

ParameterTypeDescription
filterJobSelectorSelector for which jobs to cancel

Promise<BulkOperationResult>

Result with count of cancelled jobs


deleteJob(jobId): Promise<boolean>;

Defined in: tsed/src/services/monque-service.ts:186

Permanently delete a job.

ParameterTypeDescription
jobIdstringThe ID of the job to delete

Promise<boolean>

true if deleted, false if job not found


deleteJobs(filter): Promise<BulkOperationResult>;

Defined in: tsed/src/services/monque-service.ts:220

Delete multiple jobs matching the given filter.

ParameterTypeDescription
filterJobSelectorSelector for which jobs to delete

Promise<BulkOperationResult>

Result with count of deleted jobs


enqueue<T>(
   name, 
   data, 
   options?
): Promise<PersistedJob<T>>;

Defined in: tsed/src/services/monque-service.ts:93

Enqueue a job for processing.

Type Parameter
T
ParameterTypeDescription
namestringJob type identifier (use full namespaced name, e.g., “email.send”)
dataTJob payload
options?EnqueueOptionsScheduling and deduplication options

Promise<PersistedJob<T>>

The created or existing job document


enqueueMany(jobs, options?): Promise<EnqueueManyResult>;

Defined in: tsed/src/services/monque-service.ts:98

Enqueue a batch using full namespaced job names and per-job scheduling options.

ParameterType
jobsreadonly EnqueueJob<unknown>[]
options?JobWriteOptions

Promise<EnqueueManyResult>


getJob<T>(jobId): Promise<PersistedJob<T> | null>;

Defined in: tsed/src/services/monque-service.ts:235

Get a job by its ID.

Type Parameter
T
ParameterTypeDescription
jobIdstring | ObjectIdThe job’s ObjectId (as string or ObjectId)

Promise<PersistedJob<T> | null>

The job document, or null if not found

if jobId is an invalid hex string


getJobs<T>(filter?): Promise<PersistedJob<T>[]>;

Defined in: tsed/src/services/monque-service.ts:257

Query jobs from the queue with optional filters.

Type Parameter
T
ParameterTypeDescription
filter?GetJobsFilterOptional filter criteria (name, status, limit, skip)

Promise<PersistedJob<T>[]>

Array of matching jobs


getJobsWithCursor<T>(options?): Promise<CursorPage<T>>;

Defined in: tsed/src/services/monque-service.ts:267

Get a paginated list of jobs using opaque cursors.

Type Parameter
T
ParameterTypeDescription
options?CursorOptionsPagination options (cursor, limit, direction, filter)

Promise<CursorPage<T>>

Page of jobs with next/prev cursors


getProcessingState(name?): ProcessingState;

Defined in: tsed/src/services/monque-service.ts:308

Identify and inspect the local scheduler’s global or named-worker pause state.

ParameterType
name?string

ProcessingState


getQueueStats(filter?): Promise<QueueStats>;

Defined in: tsed/src/services/monque-service.ts:277

Get aggregate statistics for the job queue.

ParameterTypeDescription
filter?Pick<JobSelector, "name">Optional filter to scope statistics by job name

Promise<QueueStats>

Queue statistics


getQueueViewSummaries(filter?): Promise<readonly QueueViewSummary[]>;

Defined in: tsed/src/services/monque-service.ts:282

Read persisted queue counts and fresh local worker policies.

ParameterType
filter?Pick<JobSelector, "name">

Promise<readonly QueueViewSummary[]>


isHealthy(): boolean;

Defined in: tsed/src/services/monque-service.ts:317

Check if the scheduler is healthy and running.

boolean

true if running and connected


isPaused(name?): boolean;

Defined in: tsed/src/services/monque-service.ts:303

Whether the local scheduler, or named worker, is effectively paused.

ParameterType
name?string

boolean


now<T>(
   name, 
   data, 
   options?
): Promise<PersistedJob<T>>;

Defined in: tsed/src/services/monque-service.ts:112

Enqueue a job for immediate processing.

Type Parameter
T
ParameterTypeDescription
namestringJob type identifier
dataTJob payload
options?NowOptions-

Promise<PersistedJob<T>>

The created job document


pause(name?): void;

Defined in: tsed/src/services/monque-service.ts:293

Pause local executions, optionally for one fully qualified job name.

ParameterType
name?string

void


rescheduleJob(jobId, runAt): Promise<PersistedJob | null>;

Defined in: tsed/src/services/monque-service.ts:165

Reschedule a pending job to run at a different time.

ParameterTypeDescription
jobIdstringThe ID of the job to reschedule
runAtDateThe new Date when the job should run

Promise<PersistedJob | null>

The updated job, or null if not found


resume(name?): void;

Defined in: tsed/src/services/monque-service.ts:298

Resume local executions without restarting the scheduler.

ParameterType
name?string

void


retryJob(jobId): Promise<PersistedJob | null>;

Defined in: tsed/src/services/monque-service.ts:154

Retry a failed or cancelled job.

ParameterTypeDescription
jobIdstringThe ID of the job to retry

Promise<PersistedJob | null>

The updated job, or null if not found


retryJobs(filter): Promise<BulkOperationResult>;

Defined in: tsed/src/services/monque-service.ts:210

Retry multiple jobs matching the given filter.

ParameterTypeDescription
filterJobSelectorSelector for which jobs to retry

Promise<BulkOperationResult>

Result with count of retried jobs


schedule<T>(
   cron, 
   name, 
   data, 
   options?
): Promise<PersistedJob<T>>;

Defined in: tsed/src/services/monque-service.ts:125

Schedule a recurring job with a cron expression.

Type Parameter
T
ParameterTypeDescription
cronstringCron expression (5-field standard or predefined like @daily)
namestringJob type identifier
dataTJob payload
options?ScheduleOptionsScheduling options

Promise<PersistedJob<T>>

The created job document


setJobPriority(jobId, priority): Promise<PersistedJob | null>;

Defined in: tsed/src/services/monque-service.ts:176

Change a pending Job’s priority, including subsequent recurring runs.

ParameterTypeDescription
jobIdstringThe ID of the pending Job
prioritynumberThe new signed safe integer priority

Promise<PersistedJob | null>

The updated Job, or null for a missing or invalid identifier