JR is a CLI program that helps you to create quality random data for your applications.
JR requires golang >= 1.20
you need just to use the provided Makefile to build JR
make all
If you want to run the Unit tests, run:
make test
To install the binary and the templates:
sudo make install
JR is very straightforward to use. Here are some examples
jr list
Use net-device template to generate a random JSON network device
jr run net-device
Using --n
option you can create more data
jr run net-device --n 3
Using --f
option you can repeat the creation every f
milliseconds
jr run net-device --n 2 --f 500
A simple way of streaming to Apache Kafka is to use kcat in conjunction with JR.
kcat needs K,V to be on a single line, so if your template generates multiline data you have to use the oneline
option to strip all newlines. The alternative is obviously to create a template without newlines, but that's not very readable!
The following line generates 5 net-device random data every half-second and writes them to topic test:
jr run net-device --n 5 --f 500 --oneline | kcat -T -F kcat/librdkafka.config -K , -P -t test