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(&self, topics: &[&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(&self)
Unsubscribe from previous subscription list.
fn assign(&self, assignment: &TopicPartitionList) -> KafkaResult<()>
Manually assign topics and partitions to consume.
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(
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
Commits the provided list of partitions. The commit can be sync (blocking), or async.
fn commit_message(&self, message: &Message, mode: CommitMode) -> KafkaResult<()>
Commits the specified message. The commit can be sync (blocking), or async.
fn subscription(&self) -> KafkaResult<TopicPartitionList>
Returns the current topic subscription.
fn assignment(&self) -> KafkaResult<TopicPartitionList>
Returns the current partition assignment.
fn committed(&self, timeout_ms: i32) -> KafkaResult<TopicPartitionList>
Retrieve committed offsets for topics and partitions.
fn offsets_for_timestamp(
&self,
timestamp: i64,
timeout_ms: i32
) -> KafkaResult<TopicPartitionList>
&self,
timestamp: i64,
timeout_ms: i32
) -> KafkaResult<TopicPartitionList>
Lookup the offsets for this consumer's partitions by timestamp.
fn position(&self) -> KafkaResult<TopicPartitionList>
Retrieve current positions (offsets) for topics and partitions.
fn fetch_metadata(&self, timeout_ms: i32) -> KafkaResult<Metadata>
Returns the metadata information for all the topics in the cluster.
fn fetch_watermarks(
&self,
topic: &str,
partition: i32,
timeout_ms: i32
) -> KafkaResult<(i64, i64)>
&self,
topic: &str,
partition: i32,
timeout_ms: i32
) -> KafkaResult<(i64, i64)>
Returns high and low watermark for the specified topic and partition.
fn fetch_group_list(
&self,
group: Option<&str>,
timeout_ms: i32
) -> KafkaResult<GroupList>
&self,
group: Option<&str>,
timeout_ms: i32
) -> KafkaResult<GroupList>
Returns the group membership information for the given group. If no group is specified, all groups will be returned.
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 subscribe(&self, topics: &Vec<&str>) -> KafkaResult<()>
Subscribe the consumer to a list of topics.
fn assign(&self, assignment: &TopicPartitionList) -> KafkaResult<()>
Manually assign topics and partitions to the consumer.
fn commit(
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
Commit offsets on broker for the provided list of partitions. If mode is set to CommitMode::Sync, the call will block until the message has been successfully committed. Read more
fn commit_message(&self, message: &Message, mode: CommitMode) -> KafkaResult<()>
Commit a specific message. If mode is set to CommitMode::Sync, the call will block until the message has been successfully committed. Read more
fn subscription(&self) -> KafkaResult<TopicPartitionList>
Returns the current topic subscription.
fn assignment(&self) -> KafkaResult<TopicPartitionList>
Returns the current partition assignment.
fn committed(&self, timeout_ms: i32) -> KafkaResult<TopicPartitionList>
Retrieve committed offsets for topics and partitions.
fn offsets_for_timestamp(
&self,
timestamp: i64,
timeout_ms: i32
) -> KafkaResult<TopicPartitionList>
&self,
timestamp: i64,
timeout_ms: i32
) -> KafkaResult<TopicPartitionList>
Lookup the offsets for this consumer's partitions by timestamp.
fn position(&self) -> KafkaResult<TopicPartitionList>
Retrieve current positions (offsets) for topics and partitions.
fn fetch_metadata(&self, timeout_ms: i32) -> KafkaResult<Metadata>
Returns the metadata information for all the topics in the cluster.
fn fetch_watermarks(
&self,
topic: &str,
partition: i32,
timeout_ms: i32
) -> KafkaResult<(i64, i64)>
&self,
topic: &str,
partition: i32,
timeout_ms: i32
) -> KafkaResult<(i64, i64)>
Returns the metadata information for all the topics in the cluster.
fn fetch_group_list(
&self,
group: Option<&str>,
timeout_ms: i32
) -> KafkaResult<GroupList>
&self,
group: Option<&str>,
timeout_ms: i32
) -> KafkaResult<GroupList>
Returns the group membership information for the given group. If no group is specified, all groups will be returned. Read more
impl FromClientConfig for BaseConsumer<EmptyConsumerContext>
[src]
fn from_config(
config: &ClientConfig
) -> KafkaResult<BaseConsumer<EmptyConsumerContext>>
config: &ClientConfig
) -> 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>>
config: &ClientConfig,
context: C
) -> KafkaResult<BaseConsumer<C>>