Go Client SDK

Info

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

Go Client SDK - 图1info

  • 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.

CodeExample

Here is the link to the sample code for message sending and receiving using the Apache RocketMQ gRPC protocol Go 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 ExamplesSimpleConsumer Examples
NormalMessageSync producer:ExampleProducerNormalMessage.go
Async producer:AsyncExampleProducerNormalMessage.go
ExampleSimpleConsumer.go
FIFOMessageExampleProducerWithFifoMessage.goExampleSimpleConsumer.go
DelayMessageExampleProducerDelayMessage.goExampleSimpleConsumer.go
TransactionMessageExampleProducerWithTransactionalMessage.goExampleSimpleConsumer.go