Struct rdkafka::consumer::stream_consumer::StreamConsumer
[−]
[src]
#[must_use = "Consumer polling thread will stop immediately if unused"]pub struct StreamConsumer<C: ConsumerContext + 'static> { /* fields omitted */ }
A Consumer with an associated polling thread. This consumer doesn't need to
be polled and it will return all consumed messages as a Stream
.
Due to the asynchronous nature of the stream, some messages might be consumed by the consumer
without being processed on the other end of the stream. If auto commit is used, it might cause
message loss after consumer restart. Manual offset commit should be used instead.
Methods
impl<C: ConsumerContext> StreamConsumer<C>
[src]
fn start(&mut self) -> MessageStream
Starts the StreamConsumer, returning a MessageStream.
fn stop(&mut self)
Stops the StreamConsumer, blocking the caller until the internal consumer has been stopped.
Trait Implementations
impl<C: ConsumerContext> Consumer<C> for StreamConsumer<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<()>
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 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)>
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>
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 StreamConsumer<EmptyConsumerContext>
[src]
fn from_config(config: &ClientConfig)
-> KafkaResult<StreamConsumer<EmptyConsumerContext>>
-> KafkaResult<StreamConsumer<EmptyConsumerContext>>
impl<C: ConsumerContext> FromClientConfigAndContext<C> for StreamConsumer<C>
[src]
Creates a new Consumer
starting from a ClientConfig
.
fn from_config_and_context(config: &ClientConfig,
context: C)
-> KafkaResult<StreamConsumer<C>>
context: C)
-> KafkaResult<StreamConsumer<C>>