WIP
authorKai Moritz <kai@juplo.de>
Wed, 24 Jan 2024 21:04:39 +0000 (22:04 +0100)
committerKai Moritz <kai@juplo.de>
Wed, 24 Jan 2024 21:04:39 +0000 (22:04 +0100)
pom.xml
src/main/java/de/juplo/kafka/SimpleProducer.java

diff --git a/pom.xml b/pom.xml
index 2928676..1c6d364 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.springframework.kafka</groupId>
+      <artifactId>spring-kafka-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.awaitility</groupId>
+      <artifactId>awaitility</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
index db554d7..06d28ff 100644 (file)
@@ -25,6 +25,7 @@ public class SimpleProducer
     Properties props = new Properties();
     props.put("bootstrap.servers", broker);
     props.put("client.id", clientId); // Nur zur Wiedererkennung
+    props.put("transactional.id", clientId); // Aktiviert außerdem enable.idempotence=true
     props.put("key.serializer", StringSerializer.class.getName());
     props.put("value.serializer", StringSerializer.class.getName());