#kafka #lua #mlua #integration #lua-jit #lua-kafka

mlua-kafka

A Rust-native implementation of lua-kafka for mlua

7 releases

0.1.7 Oct 29, 2024
0.1.6 Oct 19, 2024
0.1.5 Jul 28, 2024
0.1.4 Jan 14, 2024
0.1.0 Oct 7, 2023

#4 in #mlua

Download history 36/week @ 2024-10-06 115/week @ 2024-10-13 98/week @ 2024-10-20 133/week @ 2024-10-27 10/week @ 2024-11-03 6/week @ 2024-11-10 3/week @ 2024-11-17 1/week @ 2024-12-08

574 downloads per month

MIT license

14KB
274 lines

mlua-kafka

A Rust-native implementation of lua-kafka for mlua.

License Arch Lua

Installing

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

$ cargo add mlua-kafka --features luajit

Using

use mlua::Lua;

let lua = Lua::new();
mlua_kafka::preload(&lua);
let script = r#"
    local settings = {
        ['bootstrap.servers'] = '127.0.0.1:9092',
    }
    local producer = require('kafka').producer(settings)
    producer:produce('topic', 'mykey', 'myvalue')
    producer:flush(100)
"#;
lua.load(script).exec()?;

Integration Testing

$ KAFKA_BROKERS=127.0.0.1:9092 KAFKA_TOPIC=mytopic cargo test

Dependencies

~15–23MB
~290K SLoC