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.
12 comments · newest first
IV
Ivory
3 days ago
I feel it's not exactly-once. There’s a chance of duplicates.
CL
Claribel
8 days ago
Agreed, at-least-once makes sense. Records can be reprocessed.
KR
Krystina
13 days ago
I think it's at-least-once. The commitSync suggests that.
FE
Felicidad
18 days ago
Seems sketchy, I doubt it's exactly-once.
TE
Tenesha
23 days ago
I thought it was exactly-once with proper handling.
JU
Juliann
28 days ago
Wait, are you sure? What about the commitSync?
AU
Audrie
1 month ago
Totally agree, it's definitely at-least-once!
CR
Cristy
1 month ago
This looks like at-least-once delivery.
RE
Reena
1 month 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
2 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
2 months ago
I'm not entirely sure, but I remember something about commitSync() suggesting that it might not guarantee exactly-once delivery.
RO
Royal
2 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.