@Autowired
PartitionStatisticsRepository repository;
@Autowired
- WordcountRebalanceListener wordcountRebalanceListener;
+ SumRebalanceListener sumRebalanceListener;
@Autowired
- WordcountRecordHandler wordcountRecordHandler;
+ SumRecordHandler sumRecordHandler;
EndlessConsumer<String, String> endlessConsumer;
Map<TopicPartition, Long> oldOffsets;
Long offset = offsetConsumer.position(tp);
log.info("New position for {}: {}", tp, offset);
Integer partition = tp.partition();
- StatisticsDocument document =
+ StateDocument document =
partitionStatisticsRepository
.findById(partition.toString())
- .orElse(new StatisticsDocument(partition));
+ .orElse(new StateDocument(partition));
document.offset = offset;
partitionStatisticsRepository.save(document);
});
});
TestRecordHandler<String, String> captureOffsetAndExecuteTestHandler =
- new TestRecordHandler<String, String>(wordcountRecordHandler) {
+ new TestRecordHandler<String, String>(sumRecordHandler) {
@Override
public void onNewRecord(ConsumerRecord<String, String> record)
{
properties.getClientId(),
properties.getTopic(),
kafkaConsumer,
- wordcountRebalanceListener,
+ sumRebalanceListener,
captureOffsetAndExecuteTestHandler);
endlessConsumer.start();