Before you use the TCP client SDK for Java of the Community Edition to send and receive messages, you must prepare the environment based on the description of this topic.
Procedure
Use one of the following methods to add a dependency:
Use Maven to introduce dependencies.
<dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-client</artifactId> <version>4.5.2</version> <! -- Update to the latest version --> </dependency> <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-acl</artifactId> <version>4.5.2</version> <! -- Update to the latest version --> </dependency>
Download the dependent JAR package.
For more information, visit the Apache RocketMQ official website.
Create the resources that are required in the code in the ApsaraMQ for RocketMQ console. The resources include the ApsaraMQ for RocketMQ instance, topic, and group.
For more information, see Step 2: Create resources.