projects
/
demos
/
kafka
/
training
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Das Speichern der Daten und Offsets erfolgt nicht mehr nach jedem `poll()`
[demos/kafka/training]
/
src
/
main
/
java
/
de
/
juplo
/
kafka
/
ApplicationConfiguration.java
diff --git
a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java
b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java
index
4054e93
..
7a24c97
100644
(file)
--- a/
src/main/java/de/juplo/kafka/ApplicationConfiguration.java
+++ b/
src/main/java/de/juplo/kafka/ApplicationConfiguration.java
@@
-8,6
+8,7
@@
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import java.time.Clock;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@
-32,13
+33,17
@@
public class ApplicationConfiguration
KafkaConsumer<String, Long> kafkaConsumer,
ExecutorService executor,
Consumer<ConsumerRecord<String, Long>> handler,
KafkaConsumer<String, Long> kafkaConsumer,
ExecutorService executor,
Consumer<ConsumerRecord<String, Long>> handler,
+ PartitionStatisticsRepository repository,
ApplicationProperties properties)
{
return
new EndlessConsumer<>(
executor,
ApplicationProperties properties)
{
return
new EndlessConsumer<>(
executor,
+ repository,
properties.getClientId(),
properties.getTopic(),
properties.getClientId(),
properties.getTopic(),
+ Clock.systemDefaultZone(),
+ properties.getCommitInterval(),
kafkaConsumer,
handler);
}
kafkaConsumer,
handler);
}
@@
-57,6
+62,7
@@
public class ApplicationConfiguration
props.put("bootstrap.servers", properties.getBootstrapServer());
props.put("group.id", properties.getGroupId());
props.put("client.id", properties.getClientId());
props.put("bootstrap.servers", properties.getBootstrapServer());
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("metadata.max.age.ms", "1000");
props.put("key.deserializer", StringDeserializer.class.getName());
props.put("auto.offset.reset", properties.getAutoOffsetReset());
props.put("metadata.max.age.ms", "1000");
props.put("key.deserializer", StringDeserializer.class.getName());