Updated on 2026-04-10 GMT+08:00

Kafka Sample Project

To obtain an MRS sample project, visit https://github.com/huaweicloud/huaweicloud-mrs-example and switch to the branch that matches the MRS cluster version. Download the package to the local PC and decompress it to obtain the sample project of each component.

MRS provides the following Kafka sample projects:
Table 1 Kafka-related sample projects

Sample Project Location

Description

kafka-examples

  1. Data production using a single thread. For details, see Using Producer API to Produce Messages for Security Topics.
  2. Data consumption using a single thread. For details, see Using Consumer API to Subscribe to Security Topics and Consume.
  3. Data production using multiple threads. For details, see Using Multi-threaded Producer to Send Messages.
  4. Data consumption using multiple threads. For details, see Using Multi-thread Consumer Consuming Messages.
  5. The word counting function is implemented based on KafkaStreams. For details, see Using KafkaStreams for Statistics.