Skip to content
No description, website, or topics provided.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
test
.eslintignore
.eslintrc
.gitignore
.travis.yml
LICENSE
README.md
README.zh_CN.md
app.js
index.d.ts
package.json

README.md

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

中文版

Plugin to handle jobs and messages with Bull in Egg.js.

Bull is a fast, reliable, Redis-based queue for Node.

Install

$ npm i egg-bull-queue --save

If you use TypeScript:

$ npm i @types/bull --save-dev

Usage

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

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,
    },
  },
};

Example

app.bull.process(job => {
  console.log(job.data, job1); // 'this is a job'
});

app.bull.add({ job1: 'this is a job' });

For Bull's api read Reference for more details.

License

MIT

You can’t perform that action at this time.