How to use Spring Boot Autoconfiguration to enable exactly once delivery in Spring Kafka?
Would just setting spring.kafka.producer.transaction-id-prefix
be enough? Or do I need anything else as well?
Also, do I also need to enable idempotence as suggested by a few blogs? Or would enabling transactions anyways make sure that my producer is idempotent?
You assumption is correct. As long as you use auto-configured KafkaTemplate
in a listener thread, you got a proper Kafka transaction.
No, you don't need to configure idempotency in case of transactions.
See more info in respective Kafka docs: https://kafka.apache.org/documentation/#producerconfigs_transactional.id