Egg: 想要集成kue

Created on 1 Dec 2017  ·  7Comments  ·  Source: eggjs/egg

这边想专门起一个queue去执行异步任务,看到kue的评价不错,请问egg这边该怎么集成比较合适

All 7 comments

require kue , in some function add a task , in other project cost the task

  queue.process('email', (job, ctx, done) => {
    done();
  });

主要是类似这样的任务actionemail,想要创建一个单独email.js去处理这个任务,还有这个任务在process的时候拿不到eggctx,这个ctxkuectx,没有eggctx那么我就无法引用到sevice下的代码。egg-kue这个插件实现的内容并不是我想要的,我想要像定时任务schedule那样,统一管理queue中的任务

你是想用你之前的写好的service吧?你把emails 搞成service ,想法把kue放在一个能拿到egg ctx的函数里,这样你就拿到了service也拿到了emails, 我记得我那时候放在了app.js

@buzai 感觉还是不好,这样什么时候启动emails呢,app.js 中怎么拿到ctx

看自定义那部分

已经邮件沟通

Was this page helpful?
0 / 5 - 0 ratings

Related issues

killagu picture killagu  ·  48Comments

zlab picture zlab  ·  55Comments

fengmk2 picture fengmk2  ·  51Comments

occultskyrong picture occultskyrong  ·  35Comments

itsky365 picture itsky365  ·  62Comments