node.js - 公牛竞技场表演公牛排队

标签 node.js redis queue

我已经配置了我的公牛并创建了一个队列。

import * as Queue from 'bull';

var emailQueue = new Queue('emails', {redis: {port: 6379, host: '127.0.0.1'}});

emailQueue.process(function(job, done){
    done();
  });

  setInterval(function() {
    emailQueue.add({from: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1d2ceccc4cecfc4e1c4ccc0c8cd8fc2cecc" rel="noreferrer noopener nofollow">[email protected]</a>'}, {removeOnComplete:true});
  }, 5000);

我已经像这样配置了我的竞技场:

const Arena = require('bull-arena');
const express = require('express');

const app = express();

const arenaConfig = Arena({
  queues: [
    {
        name: "emails",
        hostId: "MyAwesomeQueues",
        redis: {
            port: 6379,
            host: "localhost"
        },
    },
  ],
},
{
  basePath: '/arena',
  disableListen: true
});

app.use('/', arenaConfig);
const PORT = 1231;
app.listen(PORT, function() {
    console.log("running on port ", PORT)
})

bull-arena 显示了我的队列,但 waiting、active、completed、failed、delayed 和 Paused 仍然显示 0。

我还有一个问题:有没有一种方法可以在不提及队列名称的情况下配置竞技场?

最佳答案

队列和竞技场配置的主机是否有不同的原因?目前一个使用“127.0.0.1”,另一个使用“localhost”。

使用 redis-cli 检查 bull 是否正在将作业添加到队列中。

您应该在 redis 中看到类似于此图片的 Bull 条目 You should see bull entries in redis similar to this image.

至于队列的名称,必须匹配,以便 Arena 可以显示正确的队列作业。

关于node.js - 公牛竞技场表演公牛排队,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57476908/

相关文章:

node.js - System.import 异步模块加载与脚本标签同步加载冲突

mysql - 问 :Bookshelf. js :How to query by bookshelfjs?

c - 我的程序出错

go - 有队列实现吗?

node.js - 如何在 Mongoose 中立即在$map之后使用$filter

javascript - 获取有关数据响应的 TCP 套接字特定数据

ruby-on-rails - Redis -- 未定义的方法 `SMEMBERS' 为 nil :NilClass

docker - Alpine OS 上的 Php7 Redis 客户端

redis - 使用redis在一组键中搜索键

java - 反转 Queue<Integer> 并将其转换为 int 数组