1.1.2 • Published 9 months ago

egg-bull-new v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

egg-bull-new

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-bull-new --save

Usage

// {app_root}/config/plugin.js
exports.bull = {
  enable: true,
  package: 'egg-bull-new',
};

Configuration

Single queue

// {app_root}/config/config.default.js
exports.bull = {
  client: {
    name: 'queue',
    redis: {
      host: 'localhost',
      port: 6379,
      db: 0,
    },
  },
};

Multiple queue (recommended)

exports.bull = {
  clients: {
    q1: { name: 'q1' },
    q2: { name: 'q2' },
  },
  default: {
    redis: {
      host: 'localhost',
      port: 6379,
      db: 0,
    },
  },
};

see config/config.default.js for more detail.

Example

// {app_root}/app/queue/video.js
module.exports = app => {
  const queue = app.bull.get('videoQueue');

  queue.process((job, done) => {
    job.progress(42);
    done();
  });

  return queue;
};

// {app_root}/app/controller/video.js
async function (ctx) {
  await ctx.queue.video.add({ video: 'http://example.com/video1.mov' });
};

For Bull's api read Reference for more details.

License

MIT

1.1.2

9 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago