为什么我们需要使用rabbitmq

发布于 2024-10-19 05:01:01 字数 160 浏览 3 评论 0原文

当我们有一个更强大的 Python 网络框架 Twisted 时,为什么我们还需要 RabbitMQ。我试图理解为什么有人想要使用 RabbitMQ 的原因。

您能否提供一个使用 RabbitMQ 的场景或示例?

另外,在哪里可以找到有关如何使用 RabbitMQ 的教程?

Why do we need RabbitMQ when we have a more powerful network framework in Python called Twisted. I am trying to understand the reason why someone would want to use RabbitMQ.

Could you please provide a scenario or an example using RabbitMQ?

Also, where can I find a tutorial on how to use RabbitMQ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

〃温暖了心ぐ 2024-10-26 05:01:01

让我告诉您一些使用 MOM(面向消息的中间件)可能是最佳选择的原因。

解耦:

可以解耦/分离应用程序的核心组件。没有必要在这里把解耦架构的所有好处都带来。我只是想指出,这是编写高质量且可维护的软件的主要要求之一。

灵活性:

使用AMQP协议将两个用不同语言编写的完全不同的应用程序连接在一起实际上非常容易。这些应用程序将在“翻译者”(MOM)的帮助下相互交谈。

可扩展性:

通过使用 MOM,我们可以水平扩展系统。一个消息生产者可以向无限数量的消息消费者传输任务、命令或消息以进行处理和扩展该系统,我们所需要做的只是创建新的消息消费者。假设我们每秒获取 1000 张图片,并且必须调整它们的大小。用传统方法解决这个问题可能会让人头疼。通过 MOM,我们可以将图像传输到消息使用者,消息使用者可以异步完成其工作并确保数据完整性完好无损。

它们也是使用 MOM 的其他好处,但我认为这 3 个是最重要的。

Let me tell you a few reasons that makes using MOM (Message Oriented Middleware) probably the best choice.

Decoupling:

It can decouple/separate the core components of the application. There is no need to bring all the benefits of the decoupled architecture here. I just want to point it out that this is one of the main requirement of writing a quality and maintainable software.

Flexibility:

It is actually very easy to connect two totally different applications written on different languages together by using AMQP protocol. These application will talk to each other by the help of a "translator" which is MOM.

Scalability:

By using MOM we can scale the system horizontally. One message producer can transmit to unlimited number of message consumers a task, a command or a message for processing and for scaling this system all we need to do is just create new message consumers. Lets say we are getting 1000 pictures per second and we must resize them. Solving this problem with traditional methods could be a headache. With MOM we can transmit images to the message consumers which can do their job asynchronously and make sure data integrity is intact.

They are other benefits of using MOM as well but these 3 are the most significant in my opinion.

请你别敷衍 2024-10-26 05:01:01

Twisted 不是队列实现。除此之外,RabbitMQ 还提供企业级排队功能并实现企业世界中经常需要的 AMQP 协议。

Twisted is not a queue implementation. Apart from that RabbitMQ offers enterprise-level queuing features and implements the AMQP protocol which is often needed in an enterprise world.

无所谓啦 2024-10-26 05:01:01

Twisted 是一个网络库,它实现了许多网络协议并允许您创建自己的网络协议。可以与 Twisted 一起使用的协议之一是 AMQP https://launchpad.net/txamqp

RabbitMQ 是一个 AMQP代理,即在应用程序外部运行的服务,可能在单独的服务器集群上。 AMQP 只是用于与 RabbitMQ 等消息队列代理进行通信的协议。您可以从 RabbitMQ 获得很多东西。您可以持续发送消息并保证交付,这样即使您的应用程序崩溃,或者 RabbitMQ 代理最终重新启动,消息也会到达。如果同一队列上有多个消费者,则可以在消息消费者之间实现负载平衡。只要您为消息正文使用合理开放的序列化格式,您就可以获得与其他语言的应用程序的互操作性。 AMQP 允许您将单一应用程序分解为许多松散耦合的部分,这些部分可以在不同的服务器上运行。这对于应用程序的长期维护来说是一个巨大的胜利。

Twisted is a networking library that implements a number of network protocols as well as allowing you to create your own. One of the protocols that you can use with Twisted is AMQP https://launchpad.net/txamqp

RabbitMQ is an AMQP broker, i.e. a services that runs outside of your application, probably on a separate cluster of servers. AMQP is merely the protocol that is used to communicate with a message queueing broker like RabbitMQ. You get a lot of things from RabbitMQ. You can send messages persistently with guaranteed delivery so they will arrive even if your app crashes, and even if the RabbitMQ broker ends up being restarted. You get load balancing between message consumers if you have multiple consumers on the same queue. You get interoperability with apps in other languages as long as you use a reasonably open serialization format for your message bodies. AMQP allows you to break up a monolithic app into many loosely coupled parts that can run on different servers. This is a big win for long term maintenance of an application.

嘿看小鸭子会跑 2024-10-26 05:01:01

RabbitMQ 不仅仅是消息传递……它是一个能够互连应用程序的通用平台。使用 RabbitMQ,Java 应用程序可以与 Linux 服务器和/或 .NET 应用程序、Ruby 和 .NET 应用程序进行通信。 Rails + 几乎任何在企业 Web 开发中找到自己位置的东西。最重要的是它实现了 AMQP 提出的“即发即忘”模型。它是 JMS 或 ESB 的完美替代品,特别是当您处理跨平台架构时,并保证可靠性。甚至还有一个称为 RPC(远程过程调用)的特殊功能,它增加了分布式架构中开发的便利性。

除此之外,在世界金融服务中,例如股票交易或股票市场,需要大量可靠且高效的路由(假设您不知道订阅您的服务的实际人数,但希望确保无论谁这样做,都会收到您的 ping,无论他们此时是否已连接,或者稍后会连接),RabbitMQ 规则,因为它基于 ERLANG 和 RabbitMQ。开放电信平台可确保高性能,同时使用最少的资源。有关 RabbitMQ 的最便捷介绍,请参阅您的本机开发语言的rabbitmq.com/getstarted.html。

RabbitMQ is a bit more than mere messaging... It's a common platform that has ability to inter-connect applications. Using RabbitMQ a Java application can speak to a Linux server and/or a .NET app, to a Ruby & rails + almost anything that finds its place in the corporate web development. And most importantly it implements the "fire and forget" model proposed by AMQP. Its just a perfect replacement for JMS or ESB, especially if you are dealing with cross platform architecture, with a guaranty of reliability. There is even a special feature called RPC (Remote procedure call) that adds to the ease of development in the distributed arch.

Apart from all these, in the world financial services like Stock-exchange or share-market where a lot of reliable and efficient routing is required (suppose you don't know the actual number of people subscribed to your services, but want to ensure that who ever does so, receives your pings whether they are connected in this moment, or will connect later), RabbitMQ rules because it's based on ERLANG & the Open-telecom platform that assures high performance while using minimum resources. For the most convenient introduction to RabbitMQ, see rabbitmq.com/getstarted.html for your native development language.

深海少女心 2024-10-26 05:01:01

RabbitMQ 是 AMQP 的实现,它定义了面向消息的中间件的可互操作协议。因此,它定义了可以在任何平台上实现的消息创建、发布、路由和消费的语义。

从概念上讲,它可以被视为 Twisted 等网络引擎的专业化,但基于行业公认的标准。

这是 Ross Mason 的博客,讨论了 AMQP 的可互操作发布-订阅的好处: http://blogs.mulesoft.org/inter-operable-publishsubscribe-with-amqp/

RabbitMQ is an implementation of AMQP, which defines an interoperable protocol for message oriented middleware. As such, it defines semantics for message creation, publication, routing and consumption that can be implemented on any platform.

Conceptually, it could be considered as a specialization of a networking engine like Twisted, but based on an industry accepted standard.

Here is a blog from Ross Mason that discusses the interest of interoperable publish-subscribe with AMQP: http://blogs.mulesoft.org/inter-operable-publishsubscribe-with-amqp/

转角预定愛 2024-10-26 05:01:01

我使用 RabbitMQ 作为 Celery 的消息代理。

另外,我还曾与 Twisted 合作过。这是不同

有关 AMQP 的更多信息,请参阅此处:http://en.wikipedia.org/wiki /Advanced_Message_Queuing_Protocol

I use RabbitMQ as message broker for Celery.

Also, I have worked with Twisted. It is different.

See here for more on AMQP: http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol

野の 2024-10-26 05:01:01

RabbitMQ 适用于 AMQP 等消息队列技术,有助于保持整洁且无延迟。

使用 RabbitMQ 的最佳场景是对数据进行后台处理,这可能需要更多时间来处理并且无法通过 HTTP 提供服务。例如,如果您想从网络应用程序下载报告。处理和下载报告生成大约需要 15-20 分钟。那么在这种情况下,您应该将下载请求推送到 RabbitMQ 队列,然后您应该期望该报告通过电子邮件或通知发送给您。

要确切了解 RabbitMQ 的工作原理或它如何解决此类用例,您应该观看此 YouTube 视频 - https://youtu。 be/vvxvlF6CJkghttps://youtu.be/0dXwJa7veI8

RabbitMQ works on message queueing technologies like AMQP which helps keep things clean and latency-free.

And the best scenario to make use of RabbitMQ is for background processing of data which can take more time to be processed and cannot be served over HTTP. For example, if you want to download a report from your web app. And that report generation takes like 15-20 mins to be processed and get downloaded. Then in that case you should be pushing the download request to the RabbitMQ queue and then you should be expecting that report to be delivered to you via email or notification.

To know about exactly how RabbitMQ works or how it solves such use cases you should check out this YouTube video - https://youtu.be/vvxvlF6CJkg and https://youtu.be/0dXwJa7veI8

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文