Struct kafka::consumer::Consumer
[−]
[src]
pub struct Consumer { // some fields omitted }
The Kafka Consumer
See module level documentation.
Methods
impl Consumer
[src]
fn from_client(client: KafkaClient, group: String, topic: String) -> Builder
Starts building a consumer for the given topic on behalf of the given group using the given kafka client.
fn from_hosts(hosts: Vec<String>, group: String, topic: String) -> Builder
Starts building a consumer for the given topic on behalf of the given group bootstraping internally a new kafka client from the given kafka hosts.
fn client(self) -> KafkaClient
Destroys this consumer returning back the underlying kafka client.
fn poll(&mut self) -> Result<MessageSets>
Polls for the next available message data.
fn single_partition_consumer(&self) -> bool
Determines whether this consumer is set up to consume only a single partition.
fn last_consumed_message(&self, partition: i32) -> Option<i64>
Retrieves the offset of the last "consumed" message in the
specified partition. Results in None
if there is no such
"consumed" message for this consumer's group in the underlying
topic.
fn consume_message(&mut self, partition: i32, offset: i64)
Marks the message at the specified offset in the specified partition as consumed by the caller.
Note: a message with a "later/higher" offset automatically marks all preceeding messages as "consumed", this is messages with "earlier/lower" offsets in the same partition. Therefore, it is not neccessary to invoke this method for every consumed message.
fn consume_messageset<'a>(&mut self, msgs: MessageSet<'a>)
A convience method to mark the given message set consumed as a whole by the caller. This is equivalent to marking the last message of the given set as consumed.
fn commit_consumed(&mut self) -> Result<()>
Persists the so-far "marked as consumed" messages (on behalf of this consumer's group for the underlying topic.)
See also Consumer::consume_message
and Consumer::consume_messetset
.