Trait rdkafka::consumer::ConsumerContext[][src]

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 { ... }
fn message_queue_nonempty_callback(&self) { ... } }

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

fn rebalance(
    &self,
    native_client: &NativeClient,
    err: RDKafkaRespErr,
    tpl: &mut TopicPartitionList
)
[src]

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.

fn pre_rebalance<'a>(&self, rebalance: &Rebalance<'a>)[src]

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

fn post_rebalance<'a>(&self, rebalance: &Rebalance<'a>)[src]

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

fn commit_callback(&self, result: KafkaResult<()>, offsets: &TopicPartitionList)[src]

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

fn main_queue_min_poll_interval(&self) -> Timeout[src]

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.

fn message_queue_nonempty_callback(&self)[src]

Message queue nonempty callback. This method will run when the consumer’s message queue switches from empty to nonempty.

Loading content...

Implementors

impl ConsumerContext for DefaultConsumerContext[src]

impl<C> ConsumerContext for StreamConsumerContext<C> where
    C: ConsumerContext
[src]

Loading content...