Java Code For Connects

Can we write the application level code(JAVA CODE) for connects as we can code for producers and consumers. Why CLI is more preferred for Kafka connect?
Thanks in advance.

Hi @shubhamshirur , What kind of interactions you have in mind?
If it is around creating a connector, checking a connector status, REST APIs seems a good way to go about it. The CLI will just call the REST endpoint. Kafka Connect integration is more about configuration, than actual coding (what you do with producer and consumer API).

Reading from docs:

Since Kafka Connect is intended to be run as a service, it also supports a REST API for managing connectors. By default this service runs on port 8083 . When executed in distributed mode, the REST API will be the primary interface to the cluster. You can make requests to any cluster member; the REST API automatically forwards requests if required.

Although you can use the standalone mode just by submitting a connector on the command line, it also runs the REST interface. This is useful for getting status information, adding and removing connectors without stopping the process, and more.

Now, if you want to do a REST call from Java, that should be no problem :slight_smile:

Does this clarify? If not, maybe you can give us more details about what you are trying to achieve?

1 Like

Thank you @gianlucanatali you clarified most of my thoughts. Very much helpful.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.