partitions.forEach(tp ->
{
Integer partition = tp.partition();
- Long offset = consumer.position(tp);
- log.info("{} - adding partition: {}, offset={}", id, partition, offset);
StateDocument document =
stateRepository
.findById(Integer.toString(partition))
.orElse(new StateDocument(partition));
+ log.info("{} - adding partition: {}, offset={}", id, partition, document.offset);
if (document.offset >= 0)
{
// Only seek, if a stored offset was found
partitions.forEach(tp ->
{
Integer partition = tp.partition();
- Long newOffset = consumer.position(tp);
+ Long offset = consumer.position(tp);
log.info(
"{} - removing partition: {}, offset of next message {})",
id,
partition,
- newOffset);
+ offset);
Map<String, Long> removed = recordHandler.removePartition(partition);
- stateRepository.save(new StateDocument(partition, removed, consumer.position(tp)));
+ stateRepository.save(new StateDocument(partition, removed, offset));
});
}