pub async fn consumer(
topic: impl Into<String>,
partition: PartitionId
) -> Result<PartitionConsumer>
👎Deprecated since 0.21.8: use
Fluvio::consumer_with_config()
insteadExpand description
Creates a consumer 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.
§Example
use futures::StreamExt;
let consumer = fluvio::consumer("my-topic", 0).await?;
let mut stream = consumer.stream(Offset::beginning()).await?;
while let Some(Ok(record)) = stream.next().await {
let key_str = record.get_key().map(|key| key.as_utf8_lossy_string());
let value_str = record.get_value().as_utf8_lossy_string();
println!("Got record: key={:?}, value={}", key_str, value_str);
}