Search code examples
apache-kafkaapache-kafka-connect

How to use Kafka connector using java code?


Currently I am using Kafka SpoolDir connector in standalone mode. After adding the required configurations to the properties file, I start the connector using

kafka/bin/connect-standalone.sh connect-standalone.properties file-source.properties

Is there any way to start the connector(stadalone/ distributed) using a java code only, in the way we can write consumer and producer java codes?


Solution

  • ConnectStandalone is the Java class that this command starts, but Connect Framework is not meant to be ran as an embedded service

    You can see the source code here that starts the server and parses the config file