Check out example codes for "A kafka topic has a replication factor of 3 and min.insync.replicas setting of 2. How many brokers can go down before a producer with acks=all can't produce? 1 0 2 3". It will help you in understanding the concepts better.
Code Example 1
Learn ReactJs, React Native from akashmittal.com