4 releases

0.1.3 Oct 4, 2024
0.1.2 Oct 4, 2024
0.1.1 Oct 2, 2024
0.1.0 Sep 25, 2024

#604 in Asynchronous

Download history 173/week @ 2024-09-23 377/week @ 2024-09-30 145/week @ 2024-10-07

695 downloads per month
Used in mostlybot

MIT license

7KB
86 lines

Franz Client

Example

This example assumes you have a franz server running on port 8085 bound to localhost.

You can spin up a test server with franz --path /tmp/franz-test

use franz_client::{ FranzClientError, FranzConsumer, FranzProducer };

#[tokio::main]
async fn main() -> Result<(), FranzClientError> {

    let mut p = FranzProducer::new("127.0.0.1:8085", "test").await?;
    p.send("i was here! :3").await?;

    let mut c = FranzConsumer::new("127.0.0.1:8085", "test").await?;
    // returns None if there are no new messages
    // and errors on incorrectly formatted message
    let msg = c.recv().await.unwrap()?;

    Ok(())
}

Dependencies

~4–12MB
~127K SLoC