Explain the exactly-once semantics in Kafka?

In Apache Kafka, exactly-once semantics ensure that every message is written only once without any data loss. This ensures that a message is not processed multiple times so that it can be persisted to the Kafka topic only once.