我试图了解什么是 JMS 以及它如何与 AMQP 术语相关联。 我知道 JMS 是一种 API,而 AMQP 是一种协议(protocol)。
这是我的假设(以及问题)
- RabbitMQ 使用 AMQP 协议(protocol)(而是实现了 AMQP 协议(protocol))
- Java客户端需要使用AMQP协议(protocol)客户端库来连接/使用RabbitMQ
- JMS API 在哪里发挥作用? JMS API 应该使用 AMQP 客户端库连接到 RabbitMQ?
- 通常我们使用 JMS 来连接 RabbitMQ、ActiveMQ 等消息代理。那么这里使用的默认协议(protocol)是什么而不是 AMQP?
上面的一些可能是愚蠢的。 :-) 但我试图绕开它。
最佳答案
你的问题有点乱,让我们一一来看。
一般概念:
Java 消息服务 (JMS) API 是一种 Java 面向消息的中间件 (MOM) API,用于在两个或多个客户端之间发送消息。 JMS 是 Java Platform, Enterprise Edition 的一部分,由在 Java Community Process 下开发的规范定义为 JSR 914。它是一种消息传递标准,允许基于 Java Enterprise Edition (Java EE) 的应用程序组件创建、发送、接收和阅读消息。它允许分布式应用程序的不同组件之间的通信是松散耦合、可靠和异步的。
现在(来自 Wikipedia):
The Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol for message-oriented middleware. The defining features of AMQP are message orientation, queuing, routing (including point-to-point and publish-and-subscribe), reliability and security.
还有最重要的(同样来自维基百科):
Unlike JMS, which merely defines an API, AMQP is a wire-level protocol. A wire-level protocol is a description of the format of the data that is sent across the network as a stream of octets. Consequently any tool that can create and interpret messages that conform to this data format can interoperate with any other compliant tool irrespective of implementation language
你应该知道的一些重要的事情:
- 请记住,AMQP 是一种不实现 JMS API 的消息传递技术。
- JMS是API,AMQP是协议(protocol)。所以说什么是JMS的默认协议(protocol)是没有意义的,当然是客户端 应用程序在调用时使用 HTTP/S 作为连接协议(protocol) WebLogic Web 服务。
- JMS 只是一个 API 规范。它不使用任何协议(protocol)。 JMS 提供者(如 ActiveMQ)可以使用任何底层协议(protocol) 实现 JMS API。例如:Apache ActiveMQ 可以使用任何 以下协议(protocol):AMQP、MQTT、OpenWire、REST(HTTP)、RSS 和 Atom, Stomp、WSIF、WS 通知、XMPP。我建议你阅读Using JMS Transport as the Connection Protocol .
祝你好运:)
关于java - JMS 和 AMQP - RabbitMQ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15150133/