Interface OffsetCommitCallback
public interface OffsetCommitCallback
A callback interface that the user can implement to trigger custom actions when a commit request completes. The callback
may be executed in any thread calling
poll()
.-
Method Summary
Modifier and Type Method Description void
onComplete(Map<TopicPartition,OffsetAndMetadata> offsets, Exception exception)
A callback method the user can implement to provide asynchronous handling of commit request completion.
-
Method Details
-
onComplete
A callback method the user can implement to provide asynchronous handling of commit request completion. This method will be called when the commit request sent to the server has been acknowledged.- Parameters:
offsets
- A map of the offsets and associated metadata that this callback applies toexception
- The exception thrown during processing of the request, or null if the commit completed successfully- Throws:
CommitFailedException
- if the commit failed and cannot be retried. This can only occur if you are using automatic group management withKafkaConsumer.subscribe(Collection)
, or if there is an active group with the same groupId which is using group management.RebalanceInProgressException
- if the commit failed because it is in the middle of a rebalance. In such cases commit could be retried after the rebalance is completed with theKafkaConsumer.poll(Duration)
call.WakeupException
- ifKafkaConsumer.wakeup()
is called before or while this function is calledInterruptException
- if the calling thread is interrupted before or while this function is calledAuthorizationException
- if not authorized to the topic or to the configured groupId. See the exception for more detailsKafkaException
- for any other unrecoverable errors (e.g. if offset metadata is too large or if the committed offset is invalid).
-