offset window for transactional services
This commit is contained in:
parent
b0bff28194
commit
4a844dcc43
1 changed files with 6 additions and 1 deletions
|
|
@ -30,6 +30,11 @@ public class OffsetChanger implements ConsumerRebalanceListener {
|
|||
.entrySet()
|
||||
.stream()
|
||||
.filter(entr -> entr.getValue() != null)
|
||||
.forEach(entry -> consumer.seek(entry.getKey(), entry.getValue().offset()));
|
||||
.forEach(entry -> {
|
||||
long offsetAssignedByKafka = consumer.position(entry.getKey());
|
||||
if (offsetAssignedByKafka > entry.getValue().offset()) {
|
||||
consumer.seek(entry.getKey(), entry.getValue().offset());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue