All Products
Search
Document Center

ApsaraMQ for RocketMQ:SDK for Java

Last Updated:Dec 13, 2024

This topic describes how to use the TCP client SDK for Java of the Community Edition to access ApsaraMQ for RocketMQ to send and receive messages.

Usage notes

SDKs of the Community Edition are used only in scenarios in which you want to migrate business in Apache RocketMQ clusters to ApsaraMQ for RocketMQ instances without code modification. For other scenarios, we recommend that you use SDKs of the Commercial Edition to connect to ApsaraMQ for RocketMQ. Compared with SDKs of the Community Edition, SDKs of the Commercial Edition provide more features and higher stability. For more information, see Release notes.

Versions

If you want to use the TCP client SDK for Java of the Community Edition to access ApsaraMQ for RocketMQ, you must download the SDK version 4.5.2 or later. We recommend that you use the latest version of the SDK. Download link: TCP client SDK for Java of the Community Edition.

Preparations

Perform the following operations in sequence:

  1. Import Maven dependencies.

  2. Create the required resources in the ApsaraMQ for RocketMQ console.

For more information, see Preparations.

(Optional) Parameters

Before you use the TCP client SDK for Java of the Community Edition to connect to ApsaraMQ for RocketMQ to send and receive messages, you must configure the required parameters. For more information, see Parameters.

You can also see the comments in the TCP client SDK for Java of the Community Edition to obtain the details of the parameters.

Use the TCP client SDK for Java of the Community Edition to send and receive messages