https://github.com/maximepeschard/kafkadog
:dog: A Kafka consumer/producer CLI
https://github.com/maximepeschard/kafkadog
cli go golang kafka kafka-client kafkacat toy-project
Last synced: 6 months ago
JSON representation
:dog: A Kafka consumer/producer CLI
- Host: GitHub
- URL: https://github.com/maximepeschard/kafkadog
- Owner: maximepeschard
- License: mit
- Created: 2020-06-05T14:18:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-21T12:23:28.000Z (about 6 years ago)
- Last Synced: 2024-06-20T13:12:46.262Z (about 2 years ago)
- Topics: cli, go, golang, kafka, kafka-client, kafkacat, toy-project
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/maximepeschard/kafkadog/releases/latest)
[](https://github.com/maximepeschard/kafkadog/actions)
[](https://goreportcard.com/report/github.com/maximepeschard/kafkadog)
# kafkadog
A Kafka consumer/producer CLI. Barking version of [Kafkacat](https://github.com/edenhill/kafkacat).
## Installation
### Homebrew
```console
$ brew install maximepeschard/tap/kafkadog
```
### go get
```console
$ go get github.com/maximepeschard/kafkadog
```
### Binary
Grab the [latest release](https://github.com/maximepeschard/kafkadog/releases/latest) for your platform.
## Example usage
### Consumer
Read messages and print their value on stdout :
```console
$ kafkadog consume -b mybroker:9092 my_topic
```
Read messages and print them with the format `topic.partition.offset -> value` on stdout :
```console
$ kafkadog consume -b mybroker:9092 -f '%t.%p.%o -> %v' my_topic
```
Read messages starting at the oldest available offset and print their value on stdout :
```console
$ kafkadog consume -b mybroker:9092 -s oldest my_topic
```
Read messages starting from a date (in UTC timezone) and print their value on stdout :
```console
$ kafkadog consume -b mybroker:9092 -s '2020-06-10 00:00:00' my_topic
```
Read messages starting from a UNIX timestamp (in milliseconds) and print their value on stdout :
```console
$ kafkadog consume -b mybroker:9092 -s 1591747200000 my_topic
```
Read messages starting at the oldest available offset and ending at a date (in UTC timezone) :
```console
$ kafkadog consume -b mybroker:9092 -s oldest -e '2020-06-10 00:00:00' my_topic
```
### Producer
Produce one message :
```console
$ echo '{"msg": "hello"}' | kafkadog produce -b mybroker:9092 my_topic
```
Produce messages read from stdin (default is one message per line, close with Ctrl-D / Ctrl-C) :
```console
$ kafkadog produce -b mybroker:9092 my_topic
```
Produce messages read from a file (default is one message per line) :
```console
$ kafkadog produce -b mybroker:9092 -f messages.txt my_topic
```
## Detailed usage
Run `kafkadog -h` for detailed usage and help.
## Credits
* [Shopify/sarama](https://github.com/Shopify/sarama)
* [spf13/cobra](https://github.com/spf13/cobra)