可以在不使用Redis的情况下使用Bull(用于作业管理)吗?
mu编码:
@Injectable()
export class MailService {
private queue: Bull.Queue;
private readonly queueName = 'mail';
constructor() {
this.queue = new Bull(this.queueName)
}
addTaskToQueue() {
this.queue.process('send_mail',
async (job: Bull.Job, done: Bull.DoneCallback) => {
console.log('Send mail!');
console.log(JSON.stringify(job.data));
done();
})
}
async send(year: number, month: number) {
try{
await this.queue.add('send_mail', {
year,
month
});
console.log('done');
} catch(err){
console.log(err);
}
}
}在运行我的控制台之后,向我推送这个错误:
{ Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379 }//////////////////////////////////////////////////////////////////////////////////////////
发布于 2020-07-15 04:44:03
Bull是建立在Redis之上的,这是它的后端。没有Redis你就不能使用它。你可以实现一些定制的系统,它不需要像Redis这样的东西,使用RxJS和一些状态管理,但是公牛必须有Redis。
https://stackoverflow.com/questions/62901179
复制相似问题