https://github.com/streamthoughts/kafka-connect-client
Java client library for Apache Kafka Connect REST Interface
https://github.com/streamthoughts/kafka-connect-client
http-client java kafka kafka-client kafka-connect
Last synced: 3 months ago
JSON representation
Java client library for Apache Kafka Connect REST Interface
- Host: GitHub
- URL: https://github.com/streamthoughts/kafka-connect-client
- Owner: streamthoughts
- License: apache-2.0
- Created: 2021-04-10T13:53:37.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-12T07:20:38.000Z (about 5 years ago)
- Last Synced: 2025-08-15T19:58:19.864Z (8 months ago)
- Topics: http-client, java, kafka, kafka-client, kafka-connect
- Language: Java
- Homepage:
- Size: 125 KB
- Stars: 6
- Watchers: 1
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.adoc
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
= Java client library for https://kafka.apache.org/documentation/#connect[Kafka Connect] REST Interface
:toc:
:toc-placement!:
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[https://github.com/streamthoughts/kafka-connect-client/blob/master/LICENSE]
image:https://img.shields.io/github/v/release/streamthoughts/kafka-connect-client[GitHub release (latest by date)]
image:https://img.shields.io/github/issues-raw/streamthoughts/kafka-connect-client[GitHub issues]
image:https://img.shields.io/github/workflow/status/streamthoughts/kafka-connect-client/Java%20CI%20with%20Maven[GitHub Workflow Status]
image:https://img.shields.io/github/stars/streamthoughts/kafka-connect-client?style=social[GitHub Repo stars]
image:https://img.shields.io/maven-central/v/io.streamthoughts/kafka-connect-client/0.1[Maven Central]
toc::[]
== 🚀 Quickstart
This project is available in Maven Central. You can add Kafka Connect Client to the dependency of the `pom.xml` of your project.
[source, xml]
----
io.streamthoughts
kafka-connect-client
0.1.0
----
=== Build the project
**Prerequisites for building the project:**
* Git
* Java 11
* Docker (for running integration-tests)
[source, bash]
----
$ git clone https://github.com/streamthoughts/kafka-connect-client.git
$ cd kafka-connect-client
./mvnw -B clean verify
----
=== Code Examples
Listing all active connectors::
[source, java]
----
ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
ConnectApi api = new ConnectApi();
final List connectors = api.listConnectors();
----
Deploying a new connector::
[source, java]
----
ApiClient apiClient = Config.defaultClient();
Configuration.setDefaultApiClient(apiClient);
KafkaConnectRestClient client = new KafkaConnectRestClient();
CompletableFuture future = client
.updateOrCreateConnectorConfig(
"filestream-source",
ConnectorConfig.builder()
.withConnectorClass("FileStreamSource")
.withTasksMax(1)
.withTopic("connect-test")
.withConnectorProp("file", "/tmp/test.txt")
);
----
Listing all failed Tasks::
[source, java]
----
ApiClient apiClient = Config.defaultClient();
Configuration.setDefaultApiClient(apiClient);
KafkaConnectRestClient client = new KafkaConnectRestClient();
List failedTasks = client.listTasksWithState(state -> state.equals(State.FAILED)).get();
----
== 🙏 Show your support
Do you think this project can help you manage Kafka Connect?
Please 🌟 this repository to support us!
== 💡Contributions
Any feedback, bug reports and PRs are greatly appreciated!
- Source Code: https://github.com/streamthoughts/kafka-connect-client[https://github.com/streamthoughts/kafka-connect-client]
- Issue Tracker: https://github.com/streamthoughts/kafka-connect-client/issues[https://github.com/streamthoughts/kafka-connect-client/issues]
== Licence
Copyright 2021 StreamThoughts.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0[http://www.apache.org/licenses/LICENSE-2.0]
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License