消息队列与任务队列的区别 [英] Message Queue vs Task Queue difference

查看:199
本文介绍了消息队列与任务队列的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道它们之间有什么区别。他们是否描述了同样的事情?



Google App Engine服务任务队列是Message Queue的实现吗?

解决方案

Facebook上的一些开发者社区组的问题。这不是专门针对GoogleAppEngine的 - 我在更广泛的意义上要求确定RabbitMQ和Celery之间的用例。以下是我得到的答案,我认为这与该主题相关,并且明确了消息队列和任务队列之间的区别。



我问:


可以说Celery是一个
QueueWrapper / QueueFramework,它可以消除
的复杂性来管理内部队列管理/队列管理活动
等?



我了解Celery是任务队列这本书的语言,
RabbitMQ是一个消息代理。然而,作为首次使用芹菜的用户似乎有点困惑
,因为我们一直认为RabbitMQ是
是'队列'。



请帮忙解释芹菜与
rabbitMQ的差异/ bquot>

$ b

回应我从 Abu Ashraf Masnun 收到


任务队列和消息队列。 RabbitMQ是一个MQ。它接收消息
并传递消息。

芹菜是一个任务队列。它接收任务及其相关数据,
运行它们并提供结果。



让我们暂时忘记芹菜吧。我们来谈谈RabbitMQ。我们通常会做什么
?我们的Django / Flask应用程序会将消息发送到
队列。我们将有一些工作人员在等待某些队列中的新
消息。当新消息到达时,它开始
工作并处理任务。



芹菜精美地管理着整个过程。我们不再需要
学习或担心AMQP或RabbitMQ的细节。我们可以使用Redis
甚至数据库(例如MySQL)作为消息代理。 Celery
允许我们用我们的工人代码定义任务。当我们需要在后台(甚至是前台)执行
的操作时,我们可以调用
这个任务(用于即时执行)或者调度这个任务来延迟
处理。 Celery将处理消息传递并运行
任务。它会启动员工,他们会知道如何运行您的
定义的任务并存储结果。因此,您可以稍后查询任务
结果,甚至在需要时查询任务进度。



您也可以使用Celery作为cron作业的替代品(尽管我不会
真的喜欢它)!

我从 Juan Francisco Calderon Zumba


我的理解是,芹菜只是实现生产者/消费者事件的高水平
抽象。它需要
几个痛苦的事情,你需要做的例如
rabbitmq。芹菜本身不是队列。事件队列在您选择的系统中存储
,芹菜可以帮助您处理这样的
事件,而无需从头开始编写生产者/消费者。




最后,这里是我最终学习的地方:


Celery是一个队列包装器/框架,它消除了
的复杂性,必须通过直接操作RabbitMQ来管理基础AMQP机制/体系结构


I wonder what is the difference between them. Are they describing the same thing?

Is Google App Engine Service Task Queue is an implementation of Message Queue?

解决方案

I asked a similar question on some Developer Community Groups on Facebook. It was not about GoogleAppEngine specifically - i asked in more of a general sense to determine use case between RabbitMQ and Celery. Here are the responses I got which I think is relevant to the topic and fairly clarifies the difference between a message queue and a task queue.

I asked:

Will it be appropriate to say that "Celery is a QueueWrapper/QueueFramework which takes away the complexity of having to manage the internal queueManagement/queueAdministration activities etc"?

I understand the book language which says "Celery is a task queue" and "RabbitMQ is a message broker". However, it seems a little confusing as a first-time celery user because we have always known RabbitMQ to be the 'queue'.

Please help in explaining how/what celery does in constrast with rabbitMQ

A response I got from Abu Ashraf Masnun

Task Queue and Message Queue. RabbitMQ is a "MQ". It receives messages and delivers messages.

Celery is a Task Queue. It receives tasks with their related data, runs them and delivers the results.

Let's forget Celery for a moment. Let's talk about RabbitMQ. What would we usually do? Our Django/Flask app would send a message to a queue. We will have some workers running which will be waiting for new messages in certain queues. When a new message arrives, it starts working and processes the tasks.

Celery manages this entire process beautifully. We no longer need to learn or worry about the details of AMQP or RabbitMQ. We can use Redis or even a database (MySQL for example) as a message broker. Celery allows us to define "Tasks" with our worker codes. When we need to do something in the background (or even foreground), we can just call this task (for instant execution) or schedule this task for delayed processing. Celery would handle the message passing and running the tasks. It would launch workers which would know how to run your defined tasks and store the results. So you can later query the task result or even task progress when needed.

You can use Celery as an alternative for cron job too (though I don't really like it)!

Another response I got from Juan Francisco Calderon Zumba

My understanding is that celery is just a very high level of abstraction to implement the producer / consumer of events. It takes out several painful things you need to do to work for example with rabbitmq. Celery itself is not the queue. The events queues are stored in the system of your choice, celery helps you to work with such events without having to write the producer / consumer from scratch.

Eventually, here is what I took home as my final learning:

Celery is a queue Wrapper/Framework which takes away the complexity of having to manage the underlying AMQP mechanisms/architecture that come with operating RabbitMQ directly

这篇关于消息队列与任务队列的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆