Kafcat is a Rust fully async rewrite of kafkacat.
I was trying to copy some data from kafka on a remote server to localhost for testing purpose. Kafkacat was the only usable tool to do so. However, it is written in C and does not support binary data at all. I was working on a pull request, but it haven't been merged yet, and the code was hard to maintain and error prone. So I wrote my own kafcat.
It mimicks kafkacat's cli usage, but with extra features. It can
Kafcat is still on early development, so
does not support TLS yet
does not support Apache AVRO
does not support complex input/output format
Compile kafcat. You can find the binary at target/release/kafcat
bash
cargo build --release
Make sure Kafka is running (We assume at localhost:9092
). You can usedocker-compose -f tests/plaintext-server.yml up
(note that kafka in docker on MacOS is problematic, I couldn't even setup the proper testing environment via docker)
Setup the listener, assuming kafcat
is in current directory
bash
./kafcat -C --topic test
Setup the producer in another terminal,
bash
./kafcat -P --topic test
Copy a topic. the format is ./kafcat copy <from> -- <to>
, from
and to
are exactly as used consumer and producer
./kafcat copy --topic test -- --topic test2
Type any key and value with the default delimiter :
. For example, hello:world
.
You should see hello:world
in the consumer terminal.
Detailed help can be found at ./kafcat --help
, ./kafcat -C --help
, ./kafcat -P --help
, etc. You can also check out kafkacat for reference.
```text kafcat-consume
USAGE:
kafcat {consume, -C} [FLAGS] [OPTIONS] --topic
FLAGS: -e, --exit Exit successfully when last message received
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-b, --brokers
-s, --format
-G, --group-id
-K
-D
-o
-p, --partition
-t, --topic
USAGE:
kafcat {produce, -P} [OPTIONS] --topic
FLAGS: -h, --help Prints help information -V, --version Prints version information
OPTIONS:
-b, --brokers
USAGE:
kafcat copy
ARGS:
FLAGS: -h, --help Prints help information -V, --version Prints version information
```
git rebase
onto master branch when possible