Function fluvio::consumer[][src]

pub async fn consumer<S: Into<String>>(
    topic: S,
    partition: i32
) -> Result<PartitionConsumer, FluvioError>

Creates a producer that receives events from the given topic and partition

This is a shortcut function that uses the current profile settings. If you need to specify any custom configurations, try directly creating a Fluvio client object instead.


use futures::StreamExt;
let consumer = fluvio::consumer("my-topic", 0).await?;
let mut stream =;
while let Some(Ok(record)) = {
    let key = record.key().map(|key| String::from_utf8_lossy(key).to_string());
    let value = String::from_utf8_lossy(record.value()).to_string();
    println!("Got record: key={:?}, value={}", key, value);