Skip to content

MonqueService

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

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:65

Access the underlying Monque instance.

Error if MonqueModule is not initialized

Monque

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

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

Cancel a pending or scheduled job.

ParameterTypeDescription
jobIdstringThe ID of the job to cancel

Promise<PersistedJob<unknown> | null>

The cancelled job, or null if not found


cancelJobs(filter): Promise<BulkOperationResult>;

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

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:161

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:195

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:87

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


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

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

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

MonqueError if jobId is an invalid hex string


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

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

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:241

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


getQueueStats(filter?): Promise<QueueStats>;

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

Get aggregate statistics for the job queue.

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

Promise<QueueStats>

Queue statistics


isHealthy(): boolean;

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

Check if the scheduler is healthy and running.

boolean

true if running and connected


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

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

Enqueue a job for immediate processing.

Type Parameter
T
ParameterTypeDescription
namestringJob type identifier
dataTJob payload

Promise<PersistedJob<T>>

The created job document


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

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

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<unknown> | null>

The updated job, or null if not found


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

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

Retry a failed or cancelled job.

ParameterTypeDescription
jobIdstringThe ID of the job to retry

Promise<PersistedJob<unknown> | null>

The updated job, or null if not found


retryJobs(filter): Promise<BulkOperationResult>;

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

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:111

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