Trait rdkafka::consumer::Consumer
[−]
[src]
pub trait Consumer<C: ConsumerContext> { fn get_base_consumer(&self) -> &BaseConsumer<C>; fn subscribe(&self, topics: &Vec<&str>) -> KafkaResult<()> { ... } fn assign(&self, assignment: &TopicPartitionList) -> KafkaResult<()> { ... } fn commit(
&self,
topic_partition_list: Option<&TopicPartitionList>,
mode: CommitMode
) -> KafkaResult<()> { ... } fn commit_message(
&self,
message: &BorrowedMessage,
mode: CommitMode
) -> KafkaResult<()> { ... } fn store_offset(&self, message: &BorrowedMessage) -> KafkaResult<()> { ... } fn subscription(&self) -> KafkaResult<TopicPartitionList> { ... } fn assignment(&self) -> KafkaResult<TopicPartitionList> { ... } fn committed(&self, timeout_ms: i32) -> KafkaResult<TopicPartitionList> { ... } fn offsets_for_timestamp(
&self,
timestamp: i64,
timeout_ms: i32
) -> KafkaResult<TopicPartitionList> { ... } fn position(&self) -> KafkaResult<TopicPartitionList> { ... } fn fetch_metadata(
&self,
topic: Option<&str>,
timeout_ms: i32
) -> KafkaResult<Metadata> { ... } fn fetch_watermarks(
&self,
topic: &str,
partition: i32,
timeout_ms: i32
) -> KafkaResult<(i64, i64)> { ... } fn fetch_group_list(
&self,
group: Option<&str>,
timeout_ms: i32
) -> KafkaResult<GroupList> { ... } }
Common trait for all consumers.
Required Methods
fn get_base_consumer(&self) -> &BaseConsumer<C>
Returns a reference to the BaseConsumer.
Provided Methods
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: Option<&TopicPartitionList>,
mode: CommitMode
) -> KafkaResult<()>
&self,
topic_partition_list: Option<&TopicPartitionList>,
mode: CommitMode
) -> KafkaResult<()>
Commit offsets on broker for the provided list of partitions, or the underlying consumers state if None
.
If mode is set to CommitMode::Sync, the call will block until
the message has been successfully committed.
fn commit_message(
&self,
message: &BorrowedMessage,
mode: CommitMode
) -> KafkaResult<()>
&self,
message: &BorrowedMessage,
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.
fn store_offset(&self, message: &BorrowedMessage) -> KafkaResult<()>
Store 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 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,
topic: Option<&str>,
timeout_ms: i32
) -> KafkaResult<Metadata>
&self,
topic: Option<&str>,
timeout_ms: i32
) -> KafkaResult<Metadata>
Returns the metadata information for the specified topic, or for all topics in the cluster if no topic is specified.
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.
Implementors
impl<C: ConsumerContext> Consumer<C> for BaseConsumer<C>
impl<C: ConsumerContext> Consumer<C> for StreamConsumer<C>