Before you use the SDK for Java to send and subscribe to messages, perform the steps in this topic to prepare the environment.

Procedure

  1. Use either of the following methods to add the dependency:
    • Add the dependency by using Maven:
      <dependency>
          <groupId>com.aliyun.openservices</groupId>
          <artifactId>ons-client</artifactId>
          <version>XXX</version>
          // Enter the latest version of the SDK for Java.
      </dependency>                            
    • Download the dependency JAR package: For the download link to the latest version, see the Release notes for the SDK for Java.
  2. In the Message Queue for Apache RocketMQ console, create the resources, such as topics and group IDs, that you reference in the code.
    You can create resources based on the following two protocols:

What to do next

Log configuration

More information