为什么 RabbitMQ 不支持 AMQP over HTTP 而不是 STOMP?

Why doesn't RabbitMQ support AMQP over HTTP instead of STOMP?

我知道 HTTP 是基于文本的,而 AMQP 是基于二进制的,但为什么 AMQP 不能通过 HTTP 实现(意味着每条二进制消息都作为 HTTP 负载发送)?我认为这是因为必须不断地来回 serialize/deserialize 会很慢?

STOMP 协议如何解决这个问题?我知道它将二进制到文本的转换移动到服务器,但是以 "messages" 更大为代价所以它真的比可以 serialize/deserialize AMQP 的 JS 客户端快得多吗?

虽然这个问题主要是基于意见的,但请查看 AMQP Protocol Specification 中的 1.2.4 高级消息队列协议 (AMQP) 部分:

The design of AMQ model was driven by these requirements:

  • To guarantee interoperability between conforming implementations.
  • To provide explicit control over the quality of service.
  • To be consistent and explicit in naming.
  • To allow complete configuration of server wiring via the protocol.
  • To use a command notation that maps easily into application-level API's.
  • To be clear, so each operation does exactly one thing.

The design of AMQP transport layer was driven by these main requirements, in no particular order:

  • To be compact, using a binary encoding that packs and unpacks rapidly.
  • To handle messages of any size without significant limit.
  • To carry multiple channels across a single connection.
  • To be long-lived, with no significant in-built limitations.
  • To allow asynchronous command pipe-lining.
  • To be easily extended to handle new and changed needs.
  • To be forward compatible with future versions.
  • To be repairable, using a strong assertion model.
  • To be neutral with respect to programming languages.
  • To fit a code generation process.

为了更好地理解(例如,为什么一个决定优于另一个决定),强烈建议通读整个规范。