public class ApplicationConfiguration
{
@Bean
- public Consumer<ConsumerRecord<String, String>> consumer()
+ public Consumer<ConsumerRecord<String, Long>> consumer()
{
return (record) ->
{
}
@Bean
- public EndlessConsumer<String, String> endlessConsumer(
- KafkaConsumer<String, String> kafkaConsumer,
+ public EndlessConsumer<String, Long> endlessConsumer(
+ KafkaConsumer<String, Long> kafkaConsumer,
ExecutorService executor,
- Consumer<ConsumerRecord<String, String>> handler,
+ Consumer<ConsumerRecord<String, Long>> handler,
+ PartitionStatisticsRepository repository,
ApplicationProperties properties)
{
return
new EndlessConsumer<>(
executor,
+ repository,
properties.getClientId(),
properties.getTopic(),
kafkaConsumer,
}
@Bean(destroyMethod = "close")
- public KafkaConsumer<String, String> kafkaConsumer(ApplicationProperties properties)
+ public KafkaConsumer<String, Long> kafkaConsumer(ApplicationProperties properties)
{
Properties props = new Properties();
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());