Registry / devops / adonis-resque

adonis-resque

JSON →
library2.0.2jsnpmunverified

Third-party queue wrapper for AdonisJS v6 using node-resque with Redis backend. Current version 2.0.2, stable, actively maintained. Supports basic, batch, delayed, and repeated job enqueuing, worker management, scheduler, failure handling, dependency injection in jobs, and plugins (jobLock, queueLock, retry, noop). Not compatible with AdonisJS v5. Ships TypeScript types, requires @adonisjs/core ^6.12.1 and @adonisjs/redis ^9.1.0. Key differentiators: AdonisJS native integration, sub-path imports for jobs, and built-in plugin system.

npm install adonis-resque
INSTALL
IMPORT
SIG · ADONIS-RESQUE
A
adonis-resque
devopsjavascriptv2.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BaseJob
import { BaseJob } from 'adonis-resque'
const BaseJob = require('adonis-resque').BaseJob
ESM-only package (AdonisJS v6). Named export, not default.
Worker
import { Worker } from 'adonis-resque'
import Worker from 'adonis-resque'
Named export. Default export is not available.
Queue
import { Queue } from 'adonis-resque'
import { ResqueQueue } from 'adonis-resque'
Export name is Queue, not ResqueQueue.
#jobs/*
import Example from '#jobs/example'
import Example from './app/jobs/example'
Requires sub-path import configuration in package.json and tsconfig.json.

Shows installation, creating a job class, enqueuing a background task from a controller, and starting worker/scheduler processes.

// 1. Install and configure // npm install adonis-resque@2.0.0-alpha.0 // node ace configure adonis-resque // 2. Create a job file (app/jobs/send_email.ts) import { BaseJob } from 'adonis-resque' import logger from '@adonisjs/core/services/logger' export default class SendEmail extends BaseJob { static get $$filepath() { return __filename } async perform(email: string, subject: string) { // Simulate sending email logger.info(`Sending email to ${email} with subject: ${subject}`) // Actual mail sending logic here } } // 3. Enqueue the job from a controller or service import SendEmail from '#jobs/send_email' export default class UserController { async register({ request, response }) { const { email } = request.all() // Dispatch background job await SendEmail.enqueue(email, 'Welcome!') // Or with delay (5 minutes) // await SendEmail.enqueue(email, 'Welcome!', { delay: 300 }) return response.ok({ message: 'User registered and email queued' }) } } // 4. Start the worker (e.g., in a separate process or via ace command) // node ace resque:worker // 5. Start the scheduler for delayed jobs // node ace resque:scheduler
Debug
Known issues
breakingNot compatible with AdonisJS v5.
fix
Use adonis-resque v1.x for AdonisJS v5.
affects: >=2.0.0
breakingv2 removed `this.logger` from job instances; logger must be injected or imported separately.
fix
Use `import logger from '@adonisjs/core/services/logger'` in job files.
affects: >=2.0.0
breakingv2 removed chainable methods (e.g., `.delay()`); use options object instead.
fix
Replace `Job.enqueue(args).delay(300)` with `Job.enqueue(args, { delay: 300 })`.
affects: >=2.0.0
gotchaJobs are not `@injectable`; dependency injection is available only via container in the job's constructor.
fix
Use `constructor(@inject() private someService: SomeService) {}` in job class.
affects: >=2.0.0
gotchaRequires sub-path imports configuration in both `package.json` and `tsconfig.json` for `#jobs/*` to work.
fix
Add `"#jobs/*": ["./app/jobs/*.js"]` to `package.json` exports and `tsconfig.json` paths.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module '#jobs/example' or its corresponding type declarations.
Missing sub-path import configuration in package.json or tsconfig.json.
fix
Add `"#jobs/*": ["./app/jobs/*.js"]` to `package.json` under `exports` and to `tsconfig.json` under `compilerOptions.paths`.
TypeError: Job.enqueue(...).delay is not a function
Using v2 code with v1 chainable API; delay method was removed.
fix
Use `await Job.enqueue(args, { delay: 300 })` instead of chaining.
Property 'logger' does not exist on type 'YourJob'.
v2 removed `this.logger` from job instances.
fix
Import logger separately: `import logger from '@adonisjs/core/services/logger'`.
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
@adonisjs/corerequiredPeer dependency required by AdonisJS application ecosystem
@adonisjs/redisrequiredRequired for Redis connection used by node-resque
node-resquerequiredCore library providing the Resque queue implementation
Agent activity
49 hits · last 30 days
node
42
OpenAI (training)
1
Resources
adonis-resque — npm install adonis-resque · libregistry