tree: d046682d7aac357257f6ea03b57707699ae214db [path history] [tgz]
  1. client/
  2. client-apis/
  3. client-shade/
  4. style/
  5. example.md
  6. pom.xml
  7. README.md
java/README.md

The Java Implementation

Here is the java implementation of the client for Apache RocketMQ.

Prerequisites

StageRequirements
BuildJDK 11+
RuntimeJRE 8+

Getting Started

Firstly, add the dependency to your pom.xml, and replace the ${rocketmq.version} with the latest version.

<dependency>
    <groupId>org.apache.rocketmq</groupId>
    <artifactId>rocketmq-client-java</artifactId>
    <version>${rocketmq.version}</version>
</dependency>

Note: rocketmq-client-java is a shaded jar, which means you could not substitute its dependencies. From the perspective of avoiding dependency conflicts, you may need a shaded client in most cases, but we also provided the no-shaded client.

<dependency>
    <groupId>org.apache.rocketmq</groupId>
    <artifactId>rocketmq-client-java-noshade</artifactId>
    <version>${rocketmq.version}</version>
</dependency>

You can see more code examples here.

Logging System

We use logback as our logging system and redirect the log of gRPC to SLF4j as well.

To prevent the clash of configuration file while both of rocketmq client and standard logback is introduced in the same project, we shaded a new logback using rocketmq.logback.xml/rocketmq.logback-test.xml/rocketmq.logback.groovy instead of logback.xml/logback-test.xml/logback.groovy as its configuration file in the shaded jar.

You can adjust the log level by the environment parameter or the java system property - rocketmq.log.level. See here for more details about logback log level.