Before you use code in the Java language to send and subscribe to messages, perform the steps that are described in this topic to prepare the environment.

Procedure

  1. Use one of the following methods to add a dependency:
    • Introduce a dependency by using Maven:
      <dependency>
          <groupId>com.aliyun.openservices</groupId>
          <artifactId>ons-client</artifactId>
          <!--Replace the following version number with the latest version number of Message Queue for Apache RocketMQ SDK for Java-->
          <version>1.8.8.1.Final</version>
      </dependency>                            
      Note For more information about the versions of Message Queue for Apache RocketMQ SDK for Java, see Release notes.
    • Download a JAR file that contains a dependency. For information about the download link to the latest version of Message Queue for Apache RocketMQ SDK for Java, see Release notes.
  2. You must create resources that are referred to in the code of Message Queue for Apache RocketMQ SDK for Java in the Message Queue for Apache RocketMQ console. The resources include topics and group IDs.
    You can create resources based on the following two protocols:

What to do next

Logging settings

References