kafka-workshop

Exercise: Message Delivery Acknowledgement

From the official documentation in Kafka as a Storage System:

Data written to Kafka is written to disk and replicated for fault-tolerance. Kafka allows producers to wait on acknowledgement so that a write isn’t considered complete until it is fully replicated and guaranteed to persist even if the server written to fails.

Write a new Kafka producer ProducerAcksDemo that uses ProducerConfig.ACKS_CONFIG:

The number of acknowledgments the producer requires the leader to have received before considering a request complete.

Procedure

  1. Read the official documentation about the acks configuration property.
  2. Configure a 3-broker Kafka cluster
  3. Create a topic with one partition and the replication factor of 3
  4. Write a Kafka producer ProducerAcksDemo that uses the different levels of acks:
    1. acks=0
    2. acks=1
    3. acks=all
  5. Observe their behaviour
  6. How does acks relate to min.insync.replicas configuration property?
    1. “A typical scenario would be to create a topic with a replication factor of 3, set min.insync.replicas to 2, and produce with acks of “all”. This will ensure that the producer raises an exception if a majority of replicas do not receive a write.”

Duration: 30 mins