Created
March 28, 2024 09:56
-
-
Save serdarmumcu/0bf13b65e00d0f0a8b06ba4c33af12d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class KafkaProducerConfig { | |
@Bean | |
public ProducerFactory<String, String> producerFactory() { | |
Map<String, Object> configProps = new HashMap<>(); | |
... | |
configProps.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true); | |
... | |
return new DefaultKafkaProducerFactory<>(configProps); | |
} | |
@Bean | |
public KafkaTemplate<String, String> kafkaTemplate() { | |
return new KafkaTemplate<>(producerFactory()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment