简体   繁体   English

Nestjs Bull 队列由 REST 创建

[英]Nestjs Bull Queues creating by REST

I create a system that will add a new repeatable action after the POST method.我创建了一个系统,它将在 POST 方法之后添加一个新的可重复操作。

In nest documentation, I saw that queues are registered in modules.在嵌套文档中,我看到队列是在模块中注册的。

So when I'd like to add repeatable jobs, should I create one queue and using a controller just add a new job to this queue, or should I create a separated queue?因此,当我想添加可重复的作业时,我应该创建一个队列并使用 controller 只需向该队列添加一个新作业,还是应该创建一个单独的队列? If separated - how to create using a controller?如果分开 - 如何使用 controller 创建?

I'm not sure what did you mean by "should I create a separated queue?".我不确定“我应该创建一个单独的队列吗?”是什么意思。 did you meant to create a sepeate queue per repeatable job?您是否打算为每个可重复的工作创建一个单独的队列?

the answer depends on multipel factors:答案取决于多种因素:

  1. what is the concurrency level of each and everyone of your repeatable jobs?您的每个可重复作业的并发级别是多少?
  2. does any of them has a preiority?他们中的任何一个都有优先权吗?
  3. ..... ......
  4. ..... ......

as you can see, if all the jobs will use the same bull-queue options, there is no reason to create addtional queues.如您所见,如果所有作业都使用相同的bull-queue选项,则没有理由创建额外的队列。


How do you create a queue: https://docs.nestjs.com/techniques/queues如何创建队列: https://docs.nestjs.com/techniques/queues

Is there something specific that is unclear in their toturial?他们的故事中是否有一些具体的不清楚的地方? (I used it a week ago and everything is working great in production). (我一周前使用它,一切都在生产中运行良好)。

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

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