In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Get to know JMS
JMS is the Java message Service (Java message service), the API of the java platform about message-oriented Middleware (MOM). Used in two applications or distributed system applications, message sending, message asynchronous processing. That is, the communication between applications is carried out through the JMS service for message forwarding. Asynchronous processing of messages between applications can decouple applications.
JMS has the advantages of asynchronous processing of messages, decoupling between programs, and reliable messages.
JMS message model
Queue point to point (Point to Point)
Queue queues are peer-to-peer consumption. The sender sends a message, and only one consumer can consume the message. Message producers send messages to the queue (Queue) of the message. The message of the queue can be persistent, ensuring that the message service can still deliver the message in the event of a failure.
Features:
1)。 There is only one consumer per message (Customer), and once the message is consumed, the message is no longer in the Queue.
2)。 The sender and receiver of the message have no time dependence, and the sender just sends the message, regardless of whether the consumer of the message has received the message or not.
3)。 When a message is received, a message acknowledgement (ACK) notification is sent to the message queue (Queue).
Queue model diagram:
Publish / subscribe (Publish/Subscribe)
The message publisher publishes the message, the message is delivered to all recipients through the Topic, and the message publisher and subscriber are irrelevant to each other. Topics (Topic) are mainly used to save and deliver messages.
In the publish / subscribe model, the application is composed of Topic, Publish and Subscribe.
Features:
1)。 Each message can have multiple consumer subscribers.
2)。 Publishers and subscribers have no time dependence. Subscribers to a topic (Topic) must create a subscriber before they can consume the publisher's message, and in order to consume the message, the subscriber must keep running.
3)。 Persistent subscriptions.
Topic model diagram:
Persistence of ActiveMQ message data
In order to avoid accidental machine downtime, the message is lost. The message can be persisted, and the message queue can be restored after the machine is restarted. ActiveMQ message persistence mechanisms include JDBC, AMQ, KahaDB, and LevelDB. After the message sender sends the message, the message center stores the message data to the local file, local memory or database. After the message persistence operation, the message center will first check the specified storage location after startup, and continue to send the message if there is a message that has not been sent successfully.
1) .JDBC persistence mode
This persistence method creates three tables in the database: activemq_msgs, activemq_acks, and activemq_lock. Activemq_msgs is used to store messages, and both Queue and Topic are stored in this table.
Configuration method:
Modify the conf/activemq.xml file in the installation directory. Configuration in the persistenceAdapter node.
2) .AMQ mode
The performance is higher than that of JDBC, and messages are written to the log file sequentially, resulting in higher performance. To improve performance, a message primary key index is created. The disadvantage is that the index file is very large and takes up a lot of disk space. If broker crashes, it is very slow to rebuild the index. The size of each log file is limited (the default is 32m). If you exceed this size, a file will be re-created. When all message consumption is complete, the system deletes the file or specifies it (depending on the configuration).
Configuration:
Index reconstruction takes a long time and takes up a lot of disk space, which is not recommended.
3) .KafaDB mode
KafaDB persistence is the default persistence method for ActiveMQ. Like AMQ, KafaDB persistence is based on log files, but the recovery time of KafaDB mode is much less than that of AMQ mode and uses fewer data files. It is better than AMQ persistence.
Configuration:
Directory: specifies the storage directory where messages are persisted.
JournalMaxFileLength: specifies the size of the save message log file.
4) .LevelDB mode
LevelDB persistence introduced after the ActiveMQ5.6 version. However, the performance of LevelDB is higher than that of KafaDB, and this trend is likely to follow.
Configuration:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.