Funktionsunabhängiger Name für das erweiterte Interface RebalanceListener
[demos/kafka/training] / src / main / java / de / juplo / kafka / ApplicationConfiguration.java
index 64f8738..e4ac1ab 100644 (file)
@@ -7,6 +7,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
+import java.time.Clock;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
@@ -24,7 +25,8 @@ public class ApplicationConfiguration
   {
     return new ApplicationRecordHandler(
         adderResults,
-        Optional.ofNullable(properties.getThrottle()));
+        Optional.ofNullable(properties.getThrottle()),
+        properties.getClientId());
   }
 
   @Bean
@@ -46,6 +48,9 @@ public class ApplicationConfiguration
         adderResults,
         stateRepository,
         properties.getClientId(),
+        properties.getTopic(),
+        Clock.systemDefaultZone(),
+        properties.getCommitInterval(),
         consumer);
   }
 
@@ -82,8 +87,8 @@ public class ApplicationConfiguration
     props.put("partition.assignment.strategy", "org.apache.kafka.clients.consumer.CooperativeStickyAssignor");
     props.put("group.id", properties.getGroupId());
     props.put("client.id", properties.getClientId());
+    props.put("enable.auto.commit", false);
     props.put("auto.offset.reset", properties.getAutoOffsetReset());
-    props.put("auto.commit.interval.ms", (int)properties.getCommitInterval().toMillis());
     props.put("metadata.max.age.ms", "1000");
     props.put("key.deserializer", StringDeserializer.class.getName());
     props.put("value.deserializer", StringDeserializer.class.getName());