partitions.forEach(tp ->
{
Integer partition = tp.partition();
+ log.info("{} - adding partition: {}", id, partition);
this.partitions.add(partition);
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
// Otherwise: Use initial offset, generated by Kafka
consumer.seek(tp, document.offset);
+ log.info(
+ "{} - Seeking to offset {} for partition {}",
+ id,
+ document.offset,
+ partition);
}
recordHandler.addPartition(partition, document.state);
+ for (String user : document.state.keySet())
+ {
+ log.info(
+ "{} - Restored state for partition={}|user={}: {}",
+ id,
+ partition,
+ user,
+ document.state.get(user));
+ }
adderResults.addPartition(partition, document.results);
});
}
partitions.forEach(tp ->
{
Integer partition = tp.partition();
+ log.info("{} - removing partition: {}", id, partition);
this.partitions.remove(partition);
Long offset = consumer.position(tp);
- log.info(
- "{} - removing partition: {}, offset of next message {})",
- id,
- partition,
- offset);
if (commitsEnabled)
{
+ log.info(
+ "{} - Storing {} as offset of next message for partition {}",
+ id,
+ offset,
+ partition);
Map<String, AdderResult> state = recordHandler.removePartition(partition);
+ for (String user : state.keySet())
+ {
+ log.info(
+ "{} - Saved state for partition={}|user={}: {}",
+ id,
+ partition,
+ user,
+ state.get(user));
+ }
Map<String, List<AdderResult>> results = adderResults.removePartition(partition);
stateRepository.save(new StateDocument(partition, state, results, offset));
}