pub trait OffsetCommitCallback:
Send
+ Sync
+ 'static {
// Required method
fn on_complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
offsets: &'life1 HashMap<TopicPartition, OffsetAndMetadata>,
error: Option<&'life2 Error>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
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().
§Translation notes
It runs on the task inside poll(), commit_*() or close().
Required Methods§
Sourcefn on_complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
offsets: &'life1 HashMap<TopicPartition, OffsetAndMetadata>,
error: Option<&'life2 Error>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
offsets: &'life1 HashMap<TopicPartition, OffsetAndMetadata>,
error: Option<&'life2 Error>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
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.
§Arguments
offsets- A map of the offsets and associated metadata that this callback applies toerror- The error raised during processing of the request, orNoneif the commit completed successfully
§Errors
Error::is_consumer_commit_failed_errorif the commit failed and cannot be retried. This can only occur if you are using automatic group management withKafkaConsumer::subscribe, or if there is an active group with the same groupId which is using group management.Error::is_rebalance_in_progress_errorif 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::pollcall.Error::is_wakeup_errorifKafkaConsumer::wakeupis called before or while this function is calledError::is_interrupt_errorif the calling thread is interrupted before or while this function is calledError::is_authorization_errorif not authorized to the topic or to the configured groupId. See the error for more detailsError::is_kafka_errorfor any other unrecoverable errors (e.g. if offset metadata is too large or if the committed offset is invalid).
§Translation notes
The errors above are those error may carry. An Err returned here
propagates out of the call that ran the callback, as Java’s thrown
exception does.