kafka connect api

Опубликовано: 30 Сентябрь 2024
на канале: Mon Goose
17,108
65

Kafka Connect API using a local file as a source and an existing 'MySecondTopic' topic to stream this data to.

Any changes in the file are committed to the topic (*MySecondTopic")

edit: config/connect-file-source.properties
change these:
file=text2
topic=MySecondTopic

and create a file called 'text2' in the kafka directory
and enter some text and save (use nano or similar)
Then execute the following
./bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-source.properties &

Now check using a console consumer as before and the file contents should be added:

./bin/kafka-console-consumer.sh --bootstrap-server 192.168.1.235:9092,192.168.1.235:9093,192.168.1.215:9092 --topic MySecondTopic --from-beginning

Next we look at using Postman to play with the REST API starting with:
GET http://192.168.1.235:8083/connectors/local-file-source
Change IP address to match your server. No authentication needed for this demo.