2 releases

0.1.1 Mar 9, 2024
0.1.0 Mar 2, 2024

#248 in FFI

Download history 133/week @ 2024-02-26 187/week @ 2024-03-04 117/week @ 2024-03-11 62/week @ 2024-03-18 38/week @ 2024-03-25 95/week @ 2024-04-01

393 downloads per month

MIT license

18KB
320 lines

mlua-samsa

Lua bindings for the Samsa kafka client.

License Arch Lua

Installing

Add to your Rust project using one of MLua's features: [lua51, lua52, lua53, lua54, luajit, luajit52].

$ cargo add mlua-samsa --features luajit

Using

use mlua::Lua;
use mlua_samsa;

let lua = Lua::new();
mlua_samsa::preload(&lua)?;
let script = r#"
    local samsa = require('samsa')
    local bootstrap_addrs = 'localhost:9092'
    local topic = 'my-topic'
    local producer = samsa.ProducerBuilder:new(bootstrap_addrs, topic):build()
    
    local message = {
        partition_id = 0,
        topic = topic,
        key = 'my-key',
        value = 'my-value',
    }
    producer:produce(message)     
"#;
lua.load(script).exec()?;

Testing

$ make check

Integration Testing

$ KAFKA_BROKERS=127.0.0.1:9092 KAFKA_TOPIC=abc make check

Dependencies

~8–18MB
~195K SLoC