Struct rdkafka::consumer::base_consumer::BaseConsumer
[−]
[src]
pub struct BaseConsumer<C: ConsumerContext> { /* fields omitted */ }
Low level wrapper around the librdkafka consumer. This consumer requires to be periodically polled to make progress on rebalance, callbacks and to receive messages.
Methods
impl<C: ConsumerContext> BaseConsumer<C>
[src]
fn subscribe(&mut self, topics: &Vec<&str>) -> KafkaResult<()>
Subscribes the consumer to a list of topics and/or topic sets (using regex).
Strings starting with ^
will be regex-matched to the full list of topics in
the cluster and matching topics will be added to the subscription list.
fn unsubscribe(&mut self)
Unsubscribe from previous subscription list.
fn assign(&mut self, assignment: &TopicPartitionList) -> KafkaResult<()>
Manually assign topics and partitions to consume.
fn get_subscriptions(&self) -> TopicPartitionList
Returns a list of topics or topic patterns the consumer is subscribed to.
fn poll(&self, timeout_ms: i32) -> KafkaResult<Option<Message>>
Polls the consumer for events. It won't block more than the specified timeout.
fn commit_message(&self, message: &Message, mode: CommitMode)
Commits the current message. The commit can be synk (blocking), or asynk.
Trait Implementations
impl<C: ConsumerContext> Consumer<C> for BaseConsumer<C>
[src]
fn get_base_consumer(&self) -> &BaseConsumer<C>
Returns a reference to the BaseConsumer.
fn get_base_consumer_mut(&mut self) -> &mut BaseConsumer<C>
Returns a mutable reference to the BaseConsumer.
fn subscribe(&mut self, topics: &Vec<&str>) -> KafkaResult<()>
Subscribe the consumer to a list of topics.
fn assign(&mut self, assignment: &TopicPartitionList) -> KafkaResult<()>
Manually assign topics and partitions to the consumer.
fn commit_message(&self, message: &Message, mode: CommitMode)
Commit a specific message. If mode is set to CommitMode::Sync, the call will block until the message has been succesfully committed. Read more
impl FromClientConfig for BaseConsumer<EmptyConsumerContext>
[src]
fn from_config(config: &ClientConfig)
-> KafkaResult<BaseConsumer<EmptyConsumerContext>>
-> KafkaResult<BaseConsumer<EmptyConsumerContext>>
impl<C: ConsumerContext> FromClientConfigAndContext<C> for BaseConsumer<C>
[src]
Creates a new BaseConsumer starting from a ClientConfig.
fn from_config_and_context(config: &ClientConfig,
context: C)
-> KafkaResult<BaseConsumer<C>>
context: C)
-> KafkaResult<BaseConsumer<C>>