1.1.2 • Published 8 months ago

egg-bull-new v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 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

8 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago