pub trait ConsumerContext: ClientContext {
    fn rebalance(
        &self,
        native_client: &NativeClient,
        err: RDKafkaRespErr,
        tpl: &mut TopicPartitionList
    ) { ... }
fn pre_rebalance<'a>(&self, rebalance: &Rebalance<'a>) { ... }
fn post_rebalance<'a>(&self, rebalance: &Rebalance<'a>) { ... }
fn commit_callback(
        &self,
        result: KafkaResult<()>,
        offsets: &TopicPartitionList
    ) { ... }
fn main_queue_min_poll_interval(&self) -> Timeout { ... } }
Expand description

Consumer-specific context.

This user-defined object can be used to provide custom callbacks for consumer events. Refer to the list of methods to check which callbacks can be specified.

See also the ClientContext trait.

Provided methods

Implements the default rebalancing strategy and calls the pre_rebalance and post_rebalance methods. If this method is overridden, it will be responsibility of the user to call them if needed.

Pre-rebalance callback. This method will run before the rebalance and should terminate its execution quickly.

Post-rebalance callback. This method will run after the rebalance and should terminate its execution quickly.

Post commit callback. This method will run after a group of offsets was committed to the offset store.

Returns the minimum interval at which to poll the main queue, which services the logging, stats, and error callbacks.

The main queue is polled once whenever BaseConsumer::poll is called. If poll is called with a timeout that is larger than this interval, then the main queue will be polled at that interval while the consumer queue is blocked.

For example, if the main queue’s minimum poll interval is 200ms and poll is called with a timeout of 1s, then poll may block for up to 1s waiting for a message, but it will poll the main queue every 200ms while it is waiting.

By default, the minimum poll interval for the main queue is 1s.

Implementors