Interface ShareAcknowledgment
Share groups enable cooperative consumption where multiple consumers can process records from the same partitions. Each record must be explicitly acknowledged to indicate the result of processing.
Acknowledgment types:
ACCEPT
- Record processed successfullyRELEASE
- Temporary failure, make available for retryREJECT
- Permanent failure, do not retry
This interface is only applicable when using explicit acknowledgment mode
(share.acknowledgement.mode=explicit
). In implicit mode, records are
automatically acknowledged as ACCEPT
.
Note: Acknowledgment is separate from commit operations. After acknowledging
records, use commitSync()
or commitAsync()
to persist the
acknowledgments to the broker.
- Since:
- 4.0
- Author:
- Soby Chacko
-
Method Details
-
acknowledge
void acknowledge()Acknowledge the record as successfully processed.The record will be marked as completed and will not be redelivered. The acknowledgment will be committed when:
- The next
poll()
is called (batched with fetch) commitSync()
orcommitAsync()
is explicitly called- The consumer is closed
- Throws:
IllegalStateException
- if the record has already been acknowledged- Since:
- 4.0
- The next
-
release
void release()Release the record for redelivery due to a transient failure.The record will be made available for another delivery attempt. The acknowledgment will be committed when:
- The next
poll()
is called (batched with fetch) commitSync()
orcommitAsync()
is explicitly called- The consumer is closed
- Throws:
IllegalStateException
- if the record has already been acknowledged
- The next
-
reject
void reject()Reject the record due to a permanent failure.The record will not be delivered again and will be archived. The acknowledgment will be committed when:
- The next
poll()
is called (batched with fetch) commitSync()
orcommitAsync()
is explicitly called- The consumer is closed
- Throws:
IllegalStateException
- if the record has already been acknowledged
- The next
-