Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  src
  package.json
  README.md
Size: Mime:
  README.md

Inhouse devops job queue

Usage

Create custom job

Create a class which extends the base Job class. See the job examples in test/jobs

Create queue

const JobQueue = require('@fbinhouse/devops-job-queue');

// Create a database object
let db = new JobQueue.Database('mongodb://localhost:27017/jobqueue');

// Create a queue specifying the location of the job files
let theQueue = new JobQueue.Queue(db, path.join(__dirname, 'jobs'));

// Start processing the queue
theQueue.start();

// Append a job to the queue
theQueue.queueJob('queueName', 'jobName', { params: 'go_here' }).then(jobId => {
    console.log('Queued up job', jobId);
});

// Shutdown the queue gracefully
theQueue.stop().then(done => {
    console.log('Queue is now shutdown');
    process.exit(0);
});

Development

To include or publish, you need to setup the fbinhouse gem fury repository. This is a one time thing. npm login --registry="https://npm.fury.io/fbinhouse/" --scope=@fbinhouse

Tests

npm test

Publishing

  1. npm run lint
  2. npm test
  3. Check all files are committed to git
  4. npm version patch|minor|major
  5. npm publish

TODO

  • Start using a proper unit testing lib