Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brickyang/egg-bull
https://github.com/brickyang/egg-bull
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/brickyang/egg-bull
- Owner: brickyang
- License: mit
- Created: 2018-03-29T07:19:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-30T23:33:45.000Z (over 4 years ago)
- Last Synced: 2024-10-13T22:48:58.340Z (about 2 months ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 37
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-egg - egg-bull - The fastest, most reliable, Redis-based queue for Egg.js ![](https://img.shields.io/github/stars/brickyang/egg-bull.svg?style=social&label=Star) ![](https://img.shields.io/npm/dm/egg-bull.svg?style=flat-square) (仓库 / 插件)
- awesome-egg - egg-bull - The fastest, most reliable, Redis-based queue for Egg.js (Plugins)
README
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url][npm-image]: https://img.shields.io/npm/v/egg-bull-queue.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-bull-queue
[travis-image]: https://img.shields.io/travis/brickyang/egg-bull.svg?style=flat-square
[travis-url]: https://travis-ci.org/brickyang/egg-bull
[codecov-image]: https://img.shields.io/codecov/c/github/brickyang/egg-bull.svg?style=flat-square
[codecov-url]: https://codecov.io/github/brickyang/egg-bull?branch=master
[david-image]: https://img.shields.io/david/brickyang/egg-bull.svg?style=flat-square
[david-url]: https://david-dm.org/brickyang/egg-bull
[snyk-image]: https://snyk.io/test/npm/egg-bull/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-bull
[download-image]: https://img.shields.io/npm/dm/egg-bull-queue.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-bull-queue[中文版](https://github.com/brickyang/egg-bull/blob/master/README.zh_CN.md)
Plugin to handle jobs and messages with [Bull](https://github.com/OptimalBits/bull) in Egg.js.
Bull is a fast, reliable, Redis-based queue for Node.
## Install
```bash
$ npm i egg-bull-queue --save
```If you use TypeScript:
```bash
$ npm i @types/bull --save-dev
```## Usage
```js
// {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
```js
// {app_root}/config/config.default.js
exports.bull = {
client: {
name: 'queue',
redis: {
host: 'localhost',
port: 6379,
db: 0,
},
},
};
```### Multiple queue (recommended)
```js
exports.bull = {
clients: {
q1: { name: 'q1' },
q2: { name: 'q2' },
},
default: {
redis: {
host: 'localhost',
port: 6379,
db: 0,
},
},
};
```## Example
```js
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](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queueclose) for more details.
## License
[MIT](LICENSE)