projects
/
demos
/
kafka
/
training
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4abc82d
)
fix: In `onPartitionsAssigned()` wurde der Kafka-Offset ausgegeben
author
Kai Moritz
<kai@juplo.de>
Sun, 14 Aug 2022 17:14:47 +0000
(19:14 +0200)
committer
Kai Moritz
<kai@juplo.de>
Sun, 14 Aug 2022 17:33:30 +0000
(19:33 +0200)
src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java
patch
|
blob
|
history
diff --git
a/src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java
b/src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java
index
2fccb4f
..
59b420a
100644
(file)
--- a/
src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java
+++ b/
src/main/java/de/juplo/kafka/ApplicationRebalanceListener.java
@@
-32,12
+32,11
@@
public class ApplicationRebalanceListener implements PollIntervalAwareConsumerRe
partitions.forEach(tp ->
{
Integer partition = tp.partition();
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));
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
if (document.offset >= 0)
{
// Only seek, if a stored offset was found
@@
-54,14
+53,14
@@
public class ApplicationRebalanceListener implements PollIntervalAwareConsumerRe
partitions.forEach(tp ->
{
Integer partition = tp.partition();
partitions.forEach(tp ->
{
Integer partition = tp.partition();
- Long
newO
ffset = consumer.position(tp);
+ Long
o
ffset = consumer.position(tp);
log.info(
"{} - removing partition: {}, offset of next message {})",
id,
partition,
log.info(
"{} - removing partition: {}, offset of next message {})",
id,
partition,
-
newO
ffset);
+
o
ffset);
Map<String, Long> removed = recordHandler.removePartition(partition);
Map<String, Long> removed = recordHandler.removePartition(partition);
- stateRepository.save(new StateDocument(partition, removed,
consumer.position(tp)
));
+ stateRepository.save(new StateDocument(partition, removed,
offset
));
});
}
});
}