How Tencent Cloud Built AMQP Support on RocketMQ for Scalable Messaging
This article explains the motivation, design choices, architecture, and core technical details of implementing the AMQP protocol on top of RocketMQ, including model mapping, proxy layer, LMQ queues, message flow, binary protocol handling, feature comparison, performance tuning, and future plans.
Background
AMQP (Advanced Message Queuing Protocol) was created around 2004 as a standardized, HTTP‑like protocol for messaging. The most widely used AMQP implementation is RabbitMQ (v0.9.1), which, despite its popularity, shows several limitations in large‑scale scenarios.
Limitations of RabbitMQ
Weak backlog handling : A three‑replica RabbitMQ cluster cannot scale horizontally without hitting TPS limits.
Network partition issues : Raft‑based replication can lead to split‑brain problems.
Difficult to extend and operate : Built with Erlang, making custom development and operational automation hard.
Unstable delayed‑message plugin : Enabling it often causes OOM errors.
Technical Choice
To achieve a fully self‑controlled, highly scalable, low‑maintenance AMQP solution, the team selected RocketMQ as the underlying engine for three reasons:
Full in‑house development ensures control over the product lifecycle.
RocketMQ’s recent features (LMQ, POP, etc.) greatly reduce the complexity of adapting AMQP.
Tencent Cloud has an established RocketMQ team that can provide strong technical support.
System Architecture
The solution consists of two layers:
RocketMQ Storage Pool : Multiple RocketMQ brokers form a storage pool that can be expanded vertically or horizontally, providing virtually unlimited capacity.
Proxy Adaptation Layer : A stateless proxy cluster implements the AMQP protocol. Each proxy cluster maps to a single RocketMQ topic and stores its metadata in a shared database, isolated by Proxy Id.
This design aligns with the RocketMQ 5 “compute‑storage separation” architecture and enables a Serverless‑style product.
Core Technical Points
Model Mapping
RocketMQ’s Topic model is heavy; creating millions of topics for AMQP queues would be inefficient. RocketMQ’s Light Message Queue (LMQ) provides a lightweight queue that can handle millions of queues. In the AMQP‑on‑RocketMQ model:
One Proxy cluster ↔ one RocketMQ Topic.
Each AMQP Queue ↔ one RocketMQ LMQ.
LMQ works by adding an lmq attribute to each message, allowing the broker to aggregate messages belonging to the same logical queue without creating a separate topic.
Message Sending Flow
The client SDK sends a message to the Proxy layer. The Proxy uses the Exchange’s BindingKey to determine the target queue set.
The Proxy forwards the message to the RocketMQ topic named after the Proxy Id, attaching the lmq attribute that identifies the target LMQ.
Message Consumption Flow
AMQP supports both pull and push consumption modes:
Pull mode : The Proxy translates an AMQP pull request into a RocketMQ POP request, which is stateless and directly forwarded.
Push mode : The Proxy runs a background thread that POPs messages from RocketMQ and pushes them to clients over a long‑lived connection.
Binary Protocol Parsing
AMQP defines a binary frame format. The Proxy, written in Java, reuses the QPID library’s protocol interface to handle encoding/decoding, avoiding the need to implement the binary parser from scratch.
Feature & Performance Comparison
The implementation supports most core AMQP features, such as delayed messages, retry, message tracking, and transaction messages (the latter not yet supported). Compared with RabbitMQ, it offers stable support for delay, retry, and tracking without relying on unstable plugins, while some advanced features like priority messages remain unsupported.
Initial performance tuning shows the system meets the needs of most users; further optimization is planned.
Future Outlook
In Q1 2025, Tencent Cloud plans to launch a Serverless RabbitMQ offering for public beta, with a stable release by the end of 2025. An open‑source version of the AMQP‑on‑RocketMQ implementation is also slated for release to engage the community and improve the product.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Tencent Cloud Middleware
Official account of Tencent Cloud Middleware. Focuses on microservices, messaging middleware and other cloud‑native technology trends, publishing product updates, case studies, and technical insights. Regularly hosts tech salons to share effective solutions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
