JKaf is a simple CLI client for Kafka made to simplify development and testing.
java -jar jkaf-0.1.0.jar <mode> [<option> <arg>]
- -c,--consume : Consumer mode.
- -p,--produce : Producer mode.
- -h,--help : Display this menu.
- -s,--server : Bootstrap server address.E.g -s 127.0.0.1:9027
- -g,--group-id <group_id> : Group ID. E.g -g mygrp
- -C,--commit-interval <commit_interval> : Commit interval.(optional) E.g -C 1000
- -t,--topics [,topic2...]: topic list. E.g -t topic1,topic2,topic3
- -k,--key : key associate with your message.(optional) E.g -k key1
- -m,--message : Value of your message. E.g -m "{test:'test'}"
- -f,--file <file_path> : Use a file instead. E.g -f /tmp/myfile.json
- -x,--number : For the consumer only, stop after X message. E.g -x 5")
- -e,--earliest : Read from the earliest message not committed
- -T,--truststore : truststore location.
- -tp,--truststore-password : Use SSL encryption. E.g -P mypassword1234
- -K,--keystore : keystore location.
- -kp,--keystore-password : keystore password.
- -a,--authentication : Use SSL password authentication. E.g -a mysslpasword
- -i,--install : Install a certificate .Usage: [:port] [passphrase]
java -jar jkaf-0.1.0.jar -c -s 127.0.0.1:9092 -g mygroupe -t topic1
java -jar jkaf-0.1.0.jar -c -s 127.0.0.1:9092 -g mygroupe -t topic1,topic2 -C 2000
java -jar jkaf-0.1.0.jar -p -s 127.0.0.1:9092 -t topic1 -m {test:"value"} -k key1
java -jar jkaf-0.1.0.jar -p -s 127.0.0.1:9092 -t topic1 -m {test:"value"}
java -jar jkaf-0.1.0.jar -p -s 127.0.0.1:9092 -t topic1 -f test.txt -k key1
java -jar jkaf-0.1.0.jar -p -s 127.0.0.1:9092 -g mygroupe -t topic1 -m {test:"value"} -T /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64/jre/lib/security/cacerts -K cert/server.keystore -tp changeit -kp changeit
Java uses its own keystore and trustore to manage the certificate
To import a key to the keystore :
- Step 1
openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -name [some-alias] -CAfile ca.crt -caname root
- Step 2
keytool -importkeystore -deststorepass [changeit] -destkeypass [changeit] -destkeystore server.keystore -srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass some-password -alias [some-alias]
- To import a certificate to the truststore
keytool -import -alias myalias -file public.cert -storetype JKS -keystore server.truststore
Anthony Paulin paulin.anthony@gmail.com
- I build the requirement on demands. Feel free to raise any issues.(Preferably directly from the issue tab on github)