Enqueue jobs to sidekiq from your node apps. Closely mirrors the official ruby sidekiq interface and supports job scheduling.
npm install sidekiq --save
// Require the module
const Sidekiq = require('@imcrazytwkr/node-sidekiq');
// Or import it
import Sidekiq from '@imcrazytwkr/node-sidekiq';
// Construct a sidekiq object with your redis connection and optional namespace
const sidekiq = new Sidekiq(redisCon, process.env.NODE_ENV);
// Add a job to sidekiq (returns task options object with Job ID)
const task = await sidekiq.enqueue('WorkerClass', ['argument', 'array'], {
retry: false,
queue: 'critical',
});
// Schedule a job in sidekiq (also returns task options object with Job ID)
const task = await sidekiq.enqueue('WorkerClass', ['some', 'args'], {
at: new Date(2013, 11, 1),
});
// Cancel any job you have previously started
await sidekiq.dequeue('WorkerClass', task);
Please report any bugs or feature requests on the github issues page for this project here:
https://github.com/imcrazytwkr/node-sidekiq
- Fork the repository on github
- Edit files directly inside
lib
because no translation requires! - Commit and push until you are happy with your contribution
- Make a pull request
- Thanks!
This is free software released under the MIT License. See LICENSE for details.