-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async commit is not working #227
Comments
"not working" is not enough information. Please elaborate. What behavior are you seeing? |
Offsets are not getting committed @garyrussell |
You need to subscribe (e.g. |
But block() is when you wanted a sync commit, As per the doc we can have async commit by just calling receiverOffset().commit(); |
That's a bug in the documentation; you always have to subscribe to a You can run the commit on a different thread; add See https://projectreactor.io/docs/kafka/snapshot/reference/#kafka-source |
Got it thanks |
So here's the final answer - you need When there is a commit interval, the commit task is scheduled periodically. Calling |
You can use Mono as it was designed (receiverRecord.receiverOffset().commit().then(Mono.just(receiverRecord))): return KafkaReceiver.create(receiverOptions).receive()
.flatMap(receiverRecord -> {
try {
if (receiverRecord.receiverOffset().offset() % commitBatchSize == 0) {
log.debug("Committed offset {},{}", receiverRecord.receiverOffset().topicPartition(),
receiverRecord.receiverOffset().offset());
return receiverRecord.receiverOffset().commit()
.then(Mono.just(receiverRecord));
}
} catch (Exception exception) {
log.error("Exception while committing", exception);
}
return Mono.just(receiverRecord);
}); |
This code is not working, can some please this
The text was updated successfully, but these errors were encountered: