Skip to content

fengling-inc/egg-bull

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

egg-bull

🥚 Egg.js middleware for bull

Install

yarn add @zhuowenli/egg-bull

Usage

Plugin

// {app_root}/config/plugin.ts
const plugin: EggPlugin = {
    bull: {
        enable: true,
        package: '@zhuowenli/egg-bull',
    },
};

Configuration

Single queue

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

Multiple queue (recommended)

// {app_root}/config/config.default.ts
config.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.

About

🥚 Egg.js middleware for bull

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published