What is ActiveMQ used for?

I looked at him and you sent him messages. But why? Why don't you just use the database? There must be some kind of feature that ActiveMQ has, which databases do not have?

+105
activemq
09 Oct '12 at 17:36
source share
7 answers

It is used for reliable communication between two distributed processes. Yes, you could store messages in a database for communication between two processes, but as soon as a message is received, you will have to delete the message. This means that a row is inserted and deleted for each message. When you try to scale that you are reporting thousands of messages per second, databases tend to crash.

On the other hand, message-oriented environments such as ActiveMQ are created to handle these use cases. They suggest that messages in a healthy system will be deleted very quickly and can do optimizations to avoid overhead. It can also send messages to consumers, instead of the consumer having to poll a new message by executing an SQL query. This further reduces the delay associated with processing new messages sent to the system.

+165
Oct 09 '12 at 18:34
source share

ActiveMQ or, in general, all implementations oriented to Message Oriented Middleware (MOM) are intended for sending messages between two applications or two components within one application.

Essentially, MOM and databases have a common foundation in that they provide transactional and persistent data storage that can read and write. The big difference is the usage pattern β€” when the databases are very general and optimized for complex searches across multiple tables, MOMs are optimized for reading messages, one at a time in FIFO format.

JMS, which is the ActiveMQ API, is an important cornerstone in Java Enterprise applications. This makes messages common to a common format and semantics, which simplifies integration between different applications.

Of course, there are many more detailed functions that are only in ActiveMQ, wired protocols such as OpenWire, STOMP and MQTT, JMS, EIP along with Apache Camel, message templates such as "request / response" and "publish / subscribe" ", JMS Bridging, clustering ("network of brokers") that allows scaling and distribution, etc. You should read these topics a little if you are interested, because they are quite large.

+57
Oct 09 '12 at 18:24
source share

Active MQ has excellent scheduler support, which means you can schedule delivery of your message at specific times. We used this feature to send drug reminders to a patient who was loading his drug data into a health care scenario.

+21
Jan 23 '14 at 17:54 on
source share

With RDBMS, when you process a row of data, you usually update a flag indicating that the row has been processed so that the processing does not repeat.

However, in the message queue you only need to confirm the message, and the next consumer will process the next.

The difference in UPDATE status in an RDBMS is a very slow operation compared to acknowlege in activmeq.

+12
Mar 28 '14 at 13:17
source share

I would like to emphasize the following:

Untied : systems can communicate without being connected. The queue lies between the systems; one system failure will never affect the others, since communication is carried out through the Queue. Systems continue to work when they are running.

Recovery support . Messages in the queues themselves were saved. Messages can be restored later if the queue is not completed.

Reliable communication . Consider a system that processes customer requests. In normal cases, the system receives 100 requests per minute. This system is unreliable when the number of requests goes beyond the average. In this case, Queue can manage requests and can periodically send messages based on system bandwidth without violating it.

Asynchronous . Client server communication is not blocked. When a client sends a request to the server, it can perform other operations without waiting for a response. When the response that he received, the client can process at any time.

+7
Sep 25 '17 at 7:14
source share

From Wikipedia

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

As for your queries:

Why don't you use a database?

You should use the database for persistent data, not for temporary data. Suppose you have to send a message from the sender to the recipient. Upon receipt of the message, the Receiver performs one operation (receiving, processing, and forgetting). After processing this message, you do not need it at all. In this case, storing the message in a permanent database is not the right solution.

I totally agree with @Hiram Chirino's answer regarding inserting and deleting messages in the database if you use the database instead of the messaging system.

Benefits of this article and this article

  1. Enterprise integration : allows applications created in different languages ​​and in different operating systems to integrate with each other
  2. Location transparency : client applications do not need to know where service applications are located
  3. Reliable communication - message producers / consumers should not be available at the same time
  4. Scaling - can be scaled horizontally, adding more services
  5. Asynchronous communication - the client can start the message and continue other processing instead of blocking, until the service sends a response;
  6. Decrease in communication - assumptions made by customers and services are significantly reduced as a result of the previous 5 advantages. The service can change information about itself, including its location, protocol and availability, without affecting or disrupting the client.

There must be an ActiveMQ function, what database is not?

There are so many. See the documentation page for more details. Look at the use cases too.

Take a look at this presentation to understand the insides of ActiveMQ.

+5
Feb 22 '16 at 15:52
source share

Suppose you have an application that is used in several places at the same time. Also, suppose your application needs to process 1000 requests per minute or something like that, so normal db operations cannot handle such operations, Activemq acts like message processing, and all messages are queued, so even if one of your applications will work in one place another place will not be affected.

+2
Dec 09 '17 at 16:41
source share



All Articles