Original link: https://www.ahianzhang.com/post/kafka-producer-analysis/
Kafka Producer Java client is as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 45 public class MyProducer { static String topic = “test”; public static void main(String[] args) throws ExecutionException, InterruptedException { Properties props = new Properties(); props.put(“bootstrap.servers”, “localhost: 9092”); /* 0 The producer does not need to wait for any response from the server after sending the message. 1 After the producer sends the message, as long as the leader copy of the partition successfully writes the message, it will receive the message from the server.
This article is reprinted from: https://www.ahianzhang.com/post/kafka-producer-analysis/
This site is for inclusion only, and the copyright belongs to the original author.