mlua-kafka

Crates.iomlua-kafka
lib.rsmlua-kafka
version0.1.7
sourcesrc
created_at2023-10-07 12:54:31.309595
updated_at2024-10-29 13:21:49.627767
descriptionA Rust-native implementation of lua-kafka for mlua.
homepagehttps://on-prem.net
repositoryhttps://gitlab.com/megalithic-llc/mlua-kafka.git
max_upload_size
id996300
size17,242
David Rauschenbach (drauschenbach)

documentation

README

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

cargo fmt