mq message queue (a): jms and amqp difference (reproduced integration)

Foreword

In past work, we used rabbitmq and activimq, and see others used kafka and rocketmq.
But use has been limited to simple, urgent need to further improve the relevant technology.
Just recently learning springcloud components, it has two parts: bus message bus and message-driven stream, involves mq. Therefore decided to suspend springcloud, further study mq begin immediately.
Although several techniques are on top of mq message queue, but there are a lot of differences, but not open around the topic that they supported protocols and norms, as far as I know it, java development with relatively more probably jms amqp norms and protocols.
During the comparison process of learning, found that many online blog comparative analysis is very clear, they feel no need to repeat create the wheel, the following is reprinted from jms contrast and amqp performs some simple optimization format.

A reprint

Reprinted from the following: https://blog.csdn.net/hpttlook/article/details/23391967
when the initial contact message queue, online search will always be referred to a number of terms such as JMS, AMQP and so on. View some documents, some of JMS and AMQP record the following understanding.

ETC.

Generally referred to JMS (Java MessageService) actually refers to the JMS API. JMS is presented by the early Sun's messaging standards, designed to provide a unified message for the java application operations, including create, send, receive and so on. JMS has become part of the Java Enterprise Edition.
From the use of perspective, JMS and JDBC as similar roles, users are based on the corresponding interface can communicate and implement a JMS service, related operations.

JMS typically contain some of the following roles:
Elements
Notes
JMS Provider

JMS messaging middleware implements the interface, such as ActiveMQ:

  1. JMS client
    applications production or consumption message
  2. Producer the JMS / Publisher
    the JMS message producers
  3. Consumer JMS / up for Subscriber
    JMS message consumer
  4. JMS message
    message, each JMS client object transmission;
  5. Queue JMS
    Provider local store waiting to be consumed message
  6. JMS topic
    A method of providing a mechanism for a plurality of subscribers consume messages; often referred to in the MQ, topic model.

JMS provides two messaging models, peer-2-peer (point to point) and publish-subscribe (publish and subscribe) model.
When a point to point model, a message will be sent to the queue, the message queue can be consumed by a consumer.
And when using publish-subscribe model, messages can be consumed more consumers. In the publish-subscribe model, completely independent producers and consumers, without perception of each other's existence.

How news reached the consumer end is message-routing from the producer side to decide. In JMS, message routing is very simple, linked by a producer and a consumer to the same queue (p2p) or topic (pub / sub) to achieve routing messages.
JMSconsumer supports message selector (message selector), via message selectors, consumer can consume only those messages through the selector screening. In JMS brother, the illustrated message routing mechanism is as follows:
Here Insert Picture Description
the common message queue, most of them realized the JMS API, you can assume the role of JMS provider, such as ActiveMQ, Redis and RabbitMQ and so on.

AMQP

AMQP (advanced message queuing protocol) presented in 2003, was first used to solve the financial messages between different platforms deliver leading interactive question.
As the name suggests, AMQP is a protocol, more accurately, a binary wire-level protocol (link protocol). This is the essence of their difference and JMS, without defining from the AMQP API layer, but directly define data formats exchanged on the network.
This enables to achieve a natural provider of AMQP is cross-platform. Means that we can use the Java AMQP provider, while using a python producer plus a rubby the consumer.
From this point of view, AQMP http can be used to draw an analogy, do not care about language, as long as we are in accordance with the appropriate data format to send message request, client server can be in different languages and links to different languages.
In AMQP, the message routing (messagerouting) and JMS there are some differences, increase the Exchange and binding role in the AMQP. producer sends a message to the Exchange, binding decision of the Exchange message should be sent to the queue, and the consumer directly from the message queue in consumption. queue and exchange of bind has consumer to decide. AMQP routing scheme illustrating a process is as follows:
Here Insert Picture Description
now becoming a standard protocol AMQP message queue, the current popular rabbitmq, stormmq are used AMQP implemented.
Finally, the contrast JMS and AMQP as follows:

ETC. AMQP
definition Java fire Wire-protocol
Cross-language no Yes
Cross-platform no Yes
Model Message provides two models:
(. 1), the Peer-the Peer-2
(2), Pub / Sub
Provides five message model:
(. 1), Direct Exchange
(2), fanout Exchange
(. 3), Topic Change
(. 4), headers Exchange
(. 5), Exchange System
essence, the latter four and JMS pub / sub model is not much difference, only to do a more detailed breakdown on the routing mechanism;
Support message type Various message types:
TextMessage
a MapMessage
BytesMessage
StreamMessage
ObjectMessage
the Message (only the message header and properties)
byte []
When practical application, has a complex message, the message can be sent after the serialization.
Overview JMS defines JAVA API-level standard; in java system, multiple client can interact through both JMS, do not need to modify the application code, but its poor support for cross-platform; AMQP defines a standard wire-level protocol layer; natural cross-platform, cross-language features.

Reference documents:

  1. http://en.wikipedia.org/wiki/AMQP

  2. http://en.wikipedia.org/wiki/Java_Message_Service

  3. http://www.bytespring.com/blog/understanding-differences-between-amqp-and-jms

Reprinted two

Reprinted from: https://blog.csdn.net/u013160104/article/details/19835525

The difference between communications platforms

JMS:
Only allow communication between a message based on the JAVA platform
AMQP:
allow multiple communications message protocol, such as the storm and the java ruby jms can communicate on AMQP.
Conclusion: AMQP technology allows multiple simultaneous communications protocols

The difference between communication mechanism

JMS:
news producers and news consumers must know each other's Queue
AMQP:
news producers and news consumers need to know the other side of the Queue, the message producer through the Route key and any Exchange Queue binding. Message Queue from any consumers to obtain Exchange via Route key.

Difference message transmission mechanism

JMS:
After JMS support PTP and publis / subscribe mechanism, PTP can only point to point communication, public / subscribe request is received at one end of all other message

AMQP:

  1. All data received RouteKey same Queue
  2. Queue received data for all of the same Exchange
  3. Queue wilecard received data for all of the Exchange
  4. Webservice allows data received, etc.
Published 272 original articles · won praise 371 · Views 1.26 million +

Guess you like

Origin blog.csdn.net/tuzongxun/article/details/82782528