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

前端 未结 8 676
花落未央
花落未央 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 00:58

    From Wikipedia

    Apache ActiveMQ is an open source message broker written in Java together with a full Java Message Service (JMS) client. It provides "Enterprise Features" which in this case means fostering the communication from more than one client or server

    Regarding your queries:

    Why wouldnt you use a database?

    You should use database for persistent data and not for temporary data. Assume that you have to send a message from Sender to Receiver. On Receiving the message, Receiver execute one operation ( receive , process and forget). After processing that message, you don't need that message at all. In this case, storing the message in persistent database is not a right solution.

    I fully agree with @Hiram Chirino answer regarding inserting & deleting message in database if you use database instead of messaging system.

    Benefits from this article and this article

    1. Enterprise integration : Allowing applications built with different languages and on different operating systems to integrate with each other
    2. Location transparency : Client applications don’t need to know where the service applications are located
    3. Reliable communication – the producers/consumers of messages don’t have to be available at the same time
    4. Scaling – can scale horizontally by adding more services
    5. Asynchronous communication – a client can fire a message and continue other processing instead of blocking until the service has sent a response;
    6. Reduced coupling – the assumptions made by the clients and services are greatly reduced as a result of the previous 5 benefits. A service can change details about itself, including its location, protocol, and availability, without affecting or disrupting the client.

    There must be feature ActiveMQ has that databases dont?

    There are many. Have a look at documentation page for more details. Have a look at use-cases too.

    Have a look at this presentation to understand internals of ActiveMQ.

提交回复
热议问题