Trait rdkafka::consumer::Consumer [−][src]
Common trait for all consumers.
Note about object safety
Doing type erasure on consumers is expected to be rare (eg. Box<dyn Consumer>
). Therefore, the API is optimised for the case where a concrete
type is available. As a result, some methods are not available on trait
objects, since they are generic.
Required methods
fn client(&self) -> &Client<C>
[src]
Returns the Client
underlying this consumer.
fn group_metadata(&self) -> Option<ConsumerGroupMetadata>
[src]
Returns the current consumer group metadata associated with the consumer.
If the consumer was not configured with a group.id
, returns None
.
For use with Producer::send_offsets_to_transaction
.
fn subscribe(&self, topics: &[&str]) -> KafkaResult<()>
[src]
Subscribes the consumer to a list of topics.
fn unsubscribe(&self)
[src]
Unsubscribes the current subscription list.
fn assign(&self, assignment: &TopicPartitionList) -> KafkaResult<()>
[src]
Manually assigns topics and partitions to the consumer. If used, automatic consumer rebalance won't be activated.
fn seek<T: Into<Timeout>>(
&self,
topic: &str,
partition: i32,
offset: Offset,
timeout: T
) -> KafkaResult<()>
[src]
&self,
topic: &str,
partition: i32,
offset: Offset,
timeout: T
) -> KafkaResult<()>
Seeks to offset
for the specified topic
and partition
. After a
successful call to seek
, the next poll of the consumer will return the
message with offset
.
fn commit(
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
[src]
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
Commits the offset of the specified message. The commit can be sync (blocking), or async. Notice that when a specific offset is committed, all the previous offsets are considered committed as well. Use this method only if you are processing messages in order.
fn commit_consumer_state(&self, mode: CommitMode) -> KafkaResult<()>
[src]
Commits the current consumer state. Notice that if the consumer fails after a message has been received, but before the message has been processed by the user code, this might lead to data loss. Check the "at-least-once delivery" section in the readme for more information.
fn commit_message(
&self,
message: &BorrowedMessage<'_>,
mode: CommitMode
) -> KafkaResult<()>
[src]
&self,
message: &BorrowedMessage<'_>,
mode: CommitMode
) -> KafkaResult<()>
Commit the provided message. Note that this will also automatically commit every message with lower offset within the same partition.
fn store_offset(&self, message: &BorrowedMessage<'_>) -> KafkaResult<()>
[src]
Stores offset for this message to be used on the next (auto)commit. When
using this enable.auto.offset.store
should be set to false
in the
config.
fn store_offsets(&self, tpl: &TopicPartitionList) -> KafkaResult<()>
[src]
Store offsets to be used on the next (auto)commit. When using this
enable.auto.offset.store
should be set to false
in the config.
fn subscription(&self) -> KafkaResult<TopicPartitionList>
[src]
Returns the current topic subscription.
fn assignment(&self) -> KafkaResult<TopicPartitionList>
[src]
Returns the current partition assignment.
fn committed<T>(&self, timeout: T) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
[src]
T: Into<Timeout>,
Self: Sized,
Retrieves the committed offsets for topics and partitions.
fn committed_offsets<T>(
&self,
tpl: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
[src]
&self,
tpl: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Retrieves the committed offsets for specified topics and partitions.
fn offsets_for_timestamp<T>(
&self,
timestamp: i64,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
timestamp: i64,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
Looks up the offsets for this consumer's partitions by timestamp.
fn offsets_for_times<T>(
&self,
timestamps: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
timestamps: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
Looks up the offsets for the specified partitions by timestamp.
fn position(&self) -> KafkaResult<TopicPartitionList>
[src]
Retrieve current positions (offsets) for topics and partitions.
fn fetch_metadata<T>(
&self,
topic: Option<&str>,
timeout: T
) -> KafkaResult<Metadata> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
topic: Option<&str>,
timeout: T
) -> KafkaResult<Metadata> where
T: Into<Timeout>,
Self: Sized,
Returns the metadata information for the specified topic, or for all topics in the cluster if no topic is specified.
fn fetch_watermarks<T>(
&self,
topic: &str,
partition: i32,
timeout: T
) -> KafkaResult<(i64, i64)> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
topic: &str,
partition: i32,
timeout: T
) -> KafkaResult<(i64, i64)> where
T: Into<Timeout>,
Self: Sized,
Returns the low and high watermarks for a specific topic and partition.
fn fetch_group_list<T>(
&self,
group: Option<&str>,
timeout: T
) -> KafkaResult<GroupList> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
group: Option<&str>,
timeout: T
) -> KafkaResult<GroupList> where
T: Into<Timeout>,
Self: Sized,
Returns the group membership information for the given group. If no group is specified, all groups will be returned.
fn pause(&self, partitions: &TopicPartitionList) -> KafkaResult<()>
[src]
Pauses consumption for the provided list of partitions.
fn resume(&self, partitions: &TopicPartitionList) -> KafkaResult<()>
[src]
Resumes consumption for the provided list of partitions.
Provided methods
fn context(&self) -> &Arc<C>
[src]
Returns a reference to the ConsumerContext
used to create this
consumer.
Implementors
impl<C> Consumer<C> for BaseConsumer<C> where
C: ConsumerContext,
[src]
C: ConsumerContext,
fn client(&self) -> &Client<C>
[src]
fn group_metadata(&self) -> Option<ConsumerGroupMetadata>
[src]
fn subscribe(&self, topics: &[&str]) -> KafkaResult<()>
[src]
fn unsubscribe(&self)
[src]
fn assign(&self, assignment: &TopicPartitionList) -> KafkaResult<()>
[src]
fn seek<T: Into<Timeout>>(
&self,
topic: &str,
partition: i32,
offset: Offset,
timeout: T
) -> KafkaResult<()>
[src]
&self,
topic: &str,
partition: i32,
offset: Offset,
timeout: T
) -> KafkaResult<()>
fn commit(
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
[src]
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
fn commit_consumer_state(&self, mode: CommitMode) -> KafkaResult<()>
[src]
fn commit_message(
&self,
message: &BorrowedMessage<'_>,
mode: CommitMode
) -> KafkaResult<()>
[src]
&self,
message: &BorrowedMessage<'_>,
mode: CommitMode
) -> KafkaResult<()>
fn store_offset(&self, message: &BorrowedMessage<'_>) -> KafkaResult<()>
[src]
fn store_offsets(&self, tpl: &TopicPartitionList) -> KafkaResult<()>
[src]
fn subscription(&self) -> KafkaResult<TopicPartitionList>
[src]
fn assignment(&self) -> KafkaResult<TopicPartitionList>
[src]
fn committed<T: Into<Timeout>>(
&self,
timeout: T
) -> KafkaResult<TopicPartitionList>
[src]
&self,
timeout: T
) -> KafkaResult<TopicPartitionList>
fn committed_offsets<T: Into<Timeout>>(
&self,
tpl: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList>
[src]
&self,
tpl: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList>
fn offsets_for_timestamp<T: Into<Timeout>>(
&self,
timestamp: i64,
timeout: T
) -> KafkaResult<TopicPartitionList>
[src]
&self,
timestamp: i64,
timeout: T
) -> KafkaResult<TopicPartitionList>
fn offsets_for_times<T: Into<Timeout>>(
&self,
timestamps: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList>
[src]
&self,
timestamps: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList>
fn position(&self) -> KafkaResult<TopicPartitionList>
[src]
fn fetch_metadata<T: Into<Timeout>>(
&self,
topic: Option<&str>,
timeout: T
) -> KafkaResult<Metadata>
[src]
&self,
topic: Option<&str>,
timeout: T
) -> KafkaResult<Metadata>
fn fetch_watermarks<T: Into<Timeout>>(
&self,
topic: &str,
partition: i32,
timeout: T
) -> KafkaResult<(i64, i64)>
[src]
&self,
topic: &str,
partition: i32,
timeout: T
) -> KafkaResult<(i64, i64)>
fn fetch_group_list<T: Into<Timeout>>(
&self,
group: Option<&str>,
timeout: T
) -> KafkaResult<GroupList>
[src]
&self,
group: Option<&str>,
timeout: T
) -> KafkaResult<GroupList>
fn pause(&self, partitions: &TopicPartitionList) -> KafkaResult<()>
[src]
fn resume(&self, partitions: &TopicPartitionList) -> KafkaResult<()>
[src]
impl<C, R> Consumer<StreamConsumerContext<C>> for StreamConsumer<C, R> where
C: ConsumerContext,
[src]
C: ConsumerContext,
fn client(&self) -> &Client<StreamConsumerContext<C>>
[src]
fn group_metadata(&self) -> Option<ConsumerGroupMetadata>
[src]
fn subscribe(&self, topics: &[&str]) -> KafkaResult<()>
[src]
fn unsubscribe(&self)
[src]
fn assign(&self, assignment: &TopicPartitionList) -> KafkaResult<()>
[src]
fn seek<T: Into<Timeout>>(
&self,
topic: &str,
partition: i32,
offset: Offset,
timeout: T
) -> KafkaResult<()>
[src]
&self,
topic: &str,
partition: i32,
offset: Offset,
timeout: T
) -> KafkaResult<()>
fn commit(
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
[src]
&self,
topic_partition_list: &TopicPartitionList,
mode: CommitMode
) -> KafkaResult<()>
fn commit_consumer_state(&self, mode: CommitMode) -> KafkaResult<()>
[src]
fn commit_message(
&self,
message: &BorrowedMessage<'_>,
mode: CommitMode
) -> KafkaResult<()>
[src]
&self,
message: &BorrowedMessage<'_>,
mode: CommitMode
) -> KafkaResult<()>
fn store_offset(&self, message: &BorrowedMessage<'_>) -> KafkaResult<()>
[src]
fn store_offsets(&self, tpl: &TopicPartitionList) -> KafkaResult<()>
[src]
fn subscription(&self) -> KafkaResult<TopicPartitionList>
[src]
fn assignment(&self) -> KafkaResult<TopicPartitionList>
[src]
fn committed<T>(&self, timeout: T) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
[src]
T: Into<Timeout>,
Self: Sized,
fn committed_offsets<T>(
&self,
tpl: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
[src]
&self,
tpl: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
fn offsets_for_timestamp<T>(
&self,
timestamp: i64,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
timestamp: i64,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
fn offsets_for_times<T>(
&self,
timestamps: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
timestamps: TopicPartitionList,
timeout: T
) -> KafkaResult<TopicPartitionList> where
T: Into<Timeout>,
Self: Sized,
fn position(&self) -> KafkaResult<TopicPartitionList>
[src]
fn fetch_metadata<T>(
&self,
topic: Option<&str>,
timeout: T
) -> KafkaResult<Metadata> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
topic: Option<&str>,
timeout: T
) -> KafkaResult<Metadata> where
T: Into<Timeout>,
Self: Sized,
fn fetch_watermarks<T>(
&self,
topic: &str,
partition: i32,
timeout: T
) -> KafkaResult<(i64, i64)> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
topic: &str,
partition: i32,
timeout: T
) -> KafkaResult<(i64, i64)> where
T: Into<Timeout>,
Self: Sized,
fn fetch_group_list<T>(
&self,
group: Option<&str>,
timeout: T
) -> KafkaResult<GroupList> where
T: Into<Timeout>,
Self: Sized,
[src]
&self,
group: Option<&str>,
timeout: T
) -> KafkaResult<GroupList> where
T: Into<Timeout>,
Self: Sized,