What is ActiveMQ used for - can we apply messaging concept using a Database?

前端 未结 8 685
花落未央
花落未央 2021-01-30 00:31

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 ActiveM

8条回答
  •  执念已碎
    2021-01-30 01:10

    It is used to reliably communicate between two distributed processes.

    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.

    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.

    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.

提交回复
热议问题