mlua-samsa

Crates.iomlua-samsa
lib.rsmlua-samsa
version0.1.2
sourcesrc
created_at2024-03-02 11:53:33.238809
updated_at2024-05-11 17:02:19.637118
descriptionLua bindings for the Samsa kafka client.
homepagehttps://on-prem.net
repositoryhttps://gitlab.com/megalithic-llc/mlua-samsa.git
max_upload_size
id1159627
size32,722
David Rauschenbach (drauschenbach)

documentation

README

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
Commit count: 43

cargo fmt