/node-sidekiq

Enqueue jobs to sidekiq from your node apps. Closely mirrors the official ruby sidekiq interface and supports job scheduling.

Primary LanguageJavaScriptOtherNOASSERTION

Add Jobs to Sidekiq from Node.js

Enqueue jobs to sidekiq from your node apps. Closely mirrors the official ruby sidekiq interface and supports job scheduling.

Installation

npm install sidekiq --save

Usage

// 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);

Reporting Bugs or Feature Requests

Please report any bugs or feature requests on the github issues page for this project here:

https://github.com/imcrazytwkr/node-sidekiq

Contributing

License

This is free software released under the MIT License. See LICENSE for details.