4 releases

0.1.4 Jan 14, 2024
0.1.3 Dec 17, 2023
0.1.2 Dec 3, 2023
0.1.1 Nov 5, 2023
0.1.0 Oct 7, 2023

#2 in #mlua

Download history 4/week @ 2024-01-08 7/week @ 2024-01-15 121/week @ 2024-01-29 78/week @ 2024-02-12 28/week @ 2024-02-26 2/week @ 2024-03-11 82/week @ 2024-04-01

84 downloads per month

MIT license

13KB
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

~19MB
~278K SLoC