public interface Acknowledgment
ConsumerRecord
. Recipients can store the
reference in asynchronous scenarios, but the internal state should be assumed transient
(i.e. it cannot be serialized and deserialized later)Modifier and Type | Method and Description |
---|---|
void |
acknowledge()
Invoked when the record or batch for which the acknowledgment has been created has
been processed.
|
default void |
nack(int index,
long sleep)
Negatively acknowledge the record at an index in a batch - commit the offset(s) of
records before the index and re-seek the partitions so that the record at the index
and subsequent records will be redelivered after the sleep time.
|
default void |
nack(long sleep)
Negatively acknowledge the current record - discard remaining records from the poll
and re-seek all partitions so that this record will be redelivered after the sleep
time.
|
void acknowledge()
default void nack(long sleep)
When using group management,
sleep + time spent processing the previous messages from the poll
must be
less than the consumer max.poll.interval.ms
property, to avoid a
rebalance.
sleep
- the time to sleep.default void nack(int index, long sleep)
When using group management,
sleep + time spent processing the records before the index
must be less
than the consumer max.poll.interval.ms
property, to avoid a rebalance.
index
- the index of the failed record in the batch.sleep
- the time to sleep.