ActiveMQ的用途是什么-我们可以使用数据库应用消息传递概念吗? [英] What is ActiveMQ used for - can we apply messaging concept using a Database?
问题描述
我查了一下,它曾经在两个系统之间发送消息。
但是为什么呢?为什么不只使用数据库
?
必须具有 ActiveMQ
的某些功能数据库
是否没有?
I looked it up and it used to send messages between 2 systems.
But why? Why wouldn't you just use a Database
?
There must be some feature that ActiveMQ
has that Databases
do not?
推荐答案
用于可靠地通信在两个分布式进程之间。
It is used to reliably communicate between two distributed processes.
是的,您可以将消息存储在数据库中,以便在两个进程之间进行通信,但是,一旦收到消息,您就可以来<< c $ c> Delete 消息,这意味着一行 INSERT
和 DELETE
用于每条消息。
当您尝试扩展以使每秒传输数千条消息时,数据库往往会崩溃
Yes, you could store messages in a Database to communicate between two processes, but, as soon as the message is received you'd have to DELETE
the message, That means a row INSERT
and DELETE
for each message.
When you try to scale that up communicating thousands of messages per second, Databases tend to fall over.
另一方面,像 ActiveMQ
这样的面向消息的中间件[MOM]则可以处理这些用例。
他们假设运行状况良好的系统中的邮件将被迅速删除,并且可以进行优化以避免开销。
Message-oriented middle-ware [MOM] like ActiveMQ
on the other hand are built to handle those use cases.
They assume that messages in a healthy system will be deleted very quickly and can do optimizations to avoid the overhead.
它还可以将消息推送给使用者,而不是使用者必须通过执行SQL查询来轮询新消息。
进一步减少了处理发送到系统中的新消息所涉及的延迟。
It can also push messages to consumers instead of a consumer having to poll for the new message by doing a SQL query.
This further reduces the latency involved in processing new messages being sent into the system.
这篇关于ActiveMQ的用途是什么-我们可以使用数据库应用消息传递概念吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!