简体   繁体   English

公牛没有 Redis 到队列管理

[英]Bull without Redis to queue management

Is it possible to use Bull(to job management) without using Redis?是否可以在不使用 Redis 的情况下使用 Bull(用于作业管理)?

mu code:亩代码:

@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);
        }

    }
}

after run my console trow me this error:运行我的控制台后给我这个错误:

{ 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 }

////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////// //////////////////////////////////

Bull is built on top of Redis, that's its backend. Bull 建立在 Redis 之上,这是它的后端。 You can't use it without Redis.如果没有 Redis,您将无法使用它。 You could probably implement some sort of custom system that doesn't require something like Redis using RxJS and some state management, but Bull must have Redis.您可能可以实施某种自定义系统,不需要Redis使用Z08E04404404203440400D566656565651537BZ和一些Z9ED39ED39E2AE2AB6B6AB6AMAN HEAMENEM MANISTING DABD3142EF5519851442EF514442144442144421444214442144214421442144214421442144214421442144421444444444444444442。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM