while (true) {
ConsumerRecords
try {
consumer.commitSync();
} catch (CommitFailedException e) {
log.error("commit failed", e)
}
for (ConsumerRecord
{
System.out.printf("topic = %s, partition = %s, offset =
%d, customer = %s, country = %s
",
record.topic(), record.partition(),
record.offset(), record.key(), record.value());
}
}
What kind of delivery guarantee this consumer offers?
Suggested Answer: C
Get Premium CCDAK Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
Here offset is committed before processing the message. If consumer crashes before processing the message, message will be lost when it comes back up.
21 comments · newest first
DO
Douglass
1 day ago
But what if the commit fails? That could lead to data loss.
BU
Burma
6 days ago
I agree with Amber. The consumer keeps trying until it succeeds.
VE
Veronika
11 days ago
No way, it's definitely at-least-once. The polling and committing show that.
MA
Maryann
17 days ago
I feel it's at-most-once. If it fails, records might be lost.
CH
Charlena
22 days ago
Exactly! It retries on failures.
AM
Amber
27 days ago
I think it's at-least-once. The commitSync suggests that.
BL
Blondell
1 month ago
Exactly! Commit failures can lead to reprocessing.
PE
Pearlene
1 month ago
I like at-least-once. It ensures no data loss.
MI
Mitsue
1 month ago
Right, at-most-once isn't applicable here either.
IV
Ivory
2 months ago
I feel it's not exactly-once. There’s a chance of duplicates.
CL
Claribel
2 months ago
Agreed, at-least-once makes sense. Records can be reprocessed.
KR
Krystina
2 months ago
I think it's at-least-once. The commitSync suggests that.
FE
Felicidad
2 months ago
Seems sketchy, I doubt it's exactly-once.
TE
Tenesha
2 months ago
I thought it was exactly-once with proper handling.
JU
Juliann
2 months ago
Wait, are you sure? What about the commitSync?
AU
Audrie
3 months ago
Totally agree, it's definitely at-least-once!
CR
Cristy
3 months ago
This looks like at-least-once delivery.
RE
Reena
3 months ago
I’m confused about the commitSync() part; does that mean it could also be at-most-once if it fails before processing?
BE
Berry
3 months ago
This looks similar to a practice question we did on Kafka consumers, and I feel like it leans towards at-least-once as well.
OD
Odette
3 months ago
I'm not entirely sure, but I remember something about commitSync() suggesting that it might not guarantee exactly-once delivery.
RO
Royal
3 months ago
I think this consumer is using at-least-once delivery because it commits after processing, but if it fails, it might reprocess records.