1. Overview
: Asynchronous consumption of data, asynchronous mailing, asynchronous query operation,
current remote call and many other framework rpc technologies are widely used, but in the face of increasingly large-scale and complex distributed systems, these technologies have the following limitations Properties:
1. Synchronous communication: After the client makes a call, it must wait for the service object to complete the processing and return the result to execute intermittently.
2. The life cycle of the client and the service object is tightly coupled: both the client and the server must operate normally. If the client's request is unreachable due to the crash of the service object or a network failure, the client will receive an exception.
3. Point-to-point communication: a call from a client is only sent to a single target object.
Message Oriented Middleware (MOM) can better solve the above problems. The sender sends the message to the message server, and the message server stores the message in several queues, and then sends the message to the receiver when the time is right. .
JAVA Message Service (JMS) defines the interface for accessing message middleware in JAVA. JMS is just an interface, not an implementation. The message middleware that implements the JMS interface is called JMS Provider. The existing MOM systems include Apache's ActiveMqQ, Alibaba's RocketMQ, IBM's MQServices, Microsoft's MSMQ, BEA's MessageQ, RabbitMQ, etc. All follow the JMS specification. 2. Message middleware Provider (MessageProvider) of JMS implementation interface : Producer Consumer (MessageConsumer): Consumer P2P: Point to point, point-to-point message model Pub/Sub: Publish/Subscribe, publish/order message model
Queue: Queue target
Topic: Topic target
ConnectionFactory: Connection factory, JMS uses it to create a connection
Connection: JMS client to JMS Provider Connection
Destination: destination of message
Session: Session, a thread that sends or receives messages
3. JMS defines Five different message body formats
StreamMessage Java primitive value data stream
MapMessage Map type key-value pair
TextMessage string pair object
ObjectMessage serialized Java object
BytesMessage data stream of uninterpreted bytes
IV
. Comparison between each message middleware 1. rocketMQ : Tested by Alibaba on Double Eleven, it has high throughput and big data processing capabilities. (Not open source)
2. rabbitMQ: good performance, highly reliable data, and support for clusters.
Kafka: High performance and high throughput. Mainly use pageCache to store data in memory. Instead of using the persistence method (data landing method and disk flushing method) to ensure the reliability of the data, replicate (saving multiple copies of data in memory) is used to ensure high availability. A small amount of data loss may occur.
3. activeMQ: IO supports random and sequential read and write, meeting more than 80% of the scenarios KahaDB, LevelDB, MYSql, etc.
ActiveMQ overview and comparison of other message middleware
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326312157&siteId=291194637
Recommended
Ranking