ApsaraMQ for RocketMQ provides two Java SDK options based on the Apache RocketMQ 5.x SDK. Use this guide to select the right SDK and version for sending and receiving messages.
The Apache RocketMQ 5.x SDK for Java requires JDK 1.8 or later.
Choose a protocol
ApsaraMQ for RocketMQ supports two SDK protocols. Select the one that fits your project:
| gRPC protocol (recommended) | Remoting protocol | |
|---|---|---|
| Artifact | rocketmq-client-java | rocketmq-client |
| Best for | New projects | Existing applications already on the Remoting protocol |
| Performance | Optimal performance and user experience | Uses the open-source Apache RocketMQ SDK |
| Spring Boot | Supported via rocketmq-v5-client-spring-boot-starter | Supported via rocketmq-spring-boot-starter |
Tip: To identify which protocol an SDK uses, check its artifact ID.
rocketmq-client-javauses gRPC;rocketmq-clientuses Remoting.For new applications, use the gRPC v2 protocol SDK for optimal performance and user experience. For details on SDK selection, see SDK reference overview.
Recommended versions
gRPC protocol SDK
These versions support the gRPC v2 protocol and have been tested and verified by Alibaba Cloud engineers.
Direct dependency (Maven)
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client-java</artifactId>
<version>5.0.7</version>
</dependency>Direct dependency (Gradle Kotlin DSL)
implementation("org.apache.rocketmq:rocketmq-client-java:5.0.7")RocketMQ-Spring dependency
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-v5-client-spring-boot-starter</artifactId>
<version>2.3.4</version>
</dependency>Remoting protocol SDK
Direct dependency (Maven)
Add both the client and ACL artifacts:
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>5.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-acl</artifactId>
<version>5.3.1</version>
</dependency>Direct dependency (Gradle Kotlin DSL)
implementation("org.apache.rocketmq:rocketmq-client:5.3.1")
implementation("org.apache.rocketmq:rocketmq-acl:5.3.1")RocketMQ-Spring dependency
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.3.4</version>
</dependency>Historical versions
To view all published versions, see the release pages on Maven Central:
gRPC protocol SDK: rocketmq-client-java releases
Remoting protocol SDK: rocketmq-client releases