kafka consumer in shell script

Viewed 10165

I am newbie in Kafka. I want to consume remote kafka message in shell script. Basically I have linux machine where I cannot run any web server (some strange reasons) only thing I can do is use crontab/shell script to listen for kafka message which is hosted remotely. Is it possible to write simple shell script which will consume kafka message, parse it and take corresponding action.

2 Answers

You could also use the tool kafkacat which is documented for example here.

This is a very powerful and fast tool to read data out of Kafka from the console and is open source: https://github.com/edenhill/kafkacat.

Many exmples are provided on GitHub and one example is shown below:

kafkacat -C -b mybroker -t mytopic
Related