0
votes

Need help in the below steps of how to consume the messages from Kafka topic and store them in a directory /tmp/kakfa-messages

Problem statement :

Create a kafka consumer to consume messages from topic 'Multibrokerapplication' and store them in '/tmp/kafka-messages'

Step 1: I'm able to consume the messages published to Topic 'Multibrokerapplication' as given below .

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic Multibrokerapplication —from-beginning

But, how to achieve the 2nd step of storing them in the folder /tmp/kafka-messages via command lines ?

Could you please suggest ?

Thanks

1
You can simply redirect the output to desired location. Can you elaborate on the problem that you are trying to solve with this logic?Rishabh Sharma

1 Answers

0
votes

Output redirection

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic Multibrokerapplication —from-beginning >> /tmp/kafka-messages

But I would suggest you try using connect-standalone command with FileSinkConnector class