Skip to main content
Version: 5.0

Java Client SDK


This section introduces sending and receiving messages using Apache RocketMQ 5.0 gRPC protocol Java SDK.

  • This sample code is built based on the gRPC protocol SDK. Therefore, the server needs to be upgraded to at least version 5.0 and enable gRPC Proxy to be compatible. Please refer to the quick start guide for deploying Proxy.
  • If you are using the Remoting protocol SDK, it is recommended to refer to the example code of the previous version 4.x for running. To identify the type of SDK you are using, please refer to the overview.


Here is the link to the sample code for message sending and receiving using the Apache RocketMQ gRPC protocol Java SDK. The complete code project and runtime environment can be found in the rocketmq-clients repository. Please refer to it for configuration and running.

MessageTypesProducer ExamplesPushConsumer ExamplesSimpleConsumer Examples
NormalMessageSync Send
Async Send
PushConsumerExample.javaSync Sub Message:
Async Sub Message:
FIFOMessageProducerFifoMessageExample.javaPushConsumerExample.javaSync Sub Message:
Async Sub Message:
DelayMessageProducerDelayMessageExample.javaPushConsumerExample.javaSync Sub Message:
Async Sub Message:
TransactionMessageProducerTransactionMessageExample.javaPushConsumerExample.javaSync Sub Message:
Async Sub Message: