kafkagosaur
Kafkagosaur is a Kafka client for Deno built using WebAssembly. The project binds to the kafka-go library.
Being cross-compiled from Go into a WebAssembly module, it should enjoy performance characteristics similar to the native code.
Supported features
- Writer
- Reader
- SASL
- TLS
- Deno streams
Examples
For comprehensive examples on how to use kafkagosaur, head over to the provided examples.
KafkaWriter
To write a message, make use of the KafkaWriter
object on the KafkaGoSaur
instance:
const kafkaGoSaur = new KafkaGoSaur();
const writer = await kafkaGoSaur.writer({
broker: "localhost:9092",
topic: "test-0",
});
const enc = new TextEncoder();
const msgs = [{ value: enc.encode("value") }];
await writer.writeMessages(msgs);
KafkaReader
To read a message, make use of the KafkaReader
object on the KafkaGoSaur
instance:
const kafkaGoSaur = new KafkaGoSaur();
const reader = await kafkaGoSaur.reader({
brokers: ["localhost:9092"],
topic: "test-0",
});
const readMsg = await reader.readMessage();
Provided examples
To run the provided examples, ensure you have docker up and running. Then start the kafka broker using
make docker
To run the writer example
deno run --allow-read --allow-net examples/writer.ts
To run the reader example
deno run --allow-read --allow-net examples/reader.ts
Development
To build the WebAssemnbly module, first run
make build
To run the tests, ensure first you have docker up and running. Then start the kafka broker using
make docker
Then run
make test
Performance benchmarks
TODO
Contributing
Kafkgagosaur is in early stage of development. Nevertheless your contributions are highly valued and welcomed! Feel free to ask for new features, report bugs, or submit your code.