Java client library for Kafka Connect REST Interface
This project is available in Maven Central. You can add Kafka Connect Client to the dependency of the pom.xml
of your project.
<dependency>
<groupId>io.streamthoughts</groupId>
<artifactId>kafka-connect-client</artifactId>
<version>0.1.0</version>
</dependency>
Prerequisites for building the project:
-
Git
-
Java 11
-
Docker (for running integration-tests)
$ git clone https://github.com/streamthoughts/kafka-connect-client.git
$ cd kafka-connect-client
./mvnw -B clean verify
- Listing all active connectors
ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
ConnectApi api = new ConnectApi();
final List<String> connectors = api.listConnectors();
- Deploying a new connector
ApiClient apiClient = Config.defaultClient();
Configuration.setDefaultApiClient(apiClient);
KafkaConnectRestClient client = new KafkaConnectRestClient();
CompletableFuture<ConnectorInfo> future = client
.updateOrCreateConnectorConfig(
"filestream-source",
ConnectorConfig.builder()
.withConnectorClass("FileStreamSource")
.withTasksMax(1)
.withTopic("connect-test")
.withConnectorProp("file", "/tmp/test.txt")
);
- Listing all failed Tasks
ApiClient apiClient = Config.defaultClient();
Configuration.setDefaultApiClient(apiClient);
KafkaConnectRestClient client = new KafkaConnectRestClient();
List<TaskState> failedTasks = client.listTasksWithState(state -> state.equals(State.FAILED)).get();
Do you think this project can help you manage Kafka Connect? Please 🌟 this repository to support us!
Any feedback, bug reports and PRs are greatly appreciated!
-
Source Code: https://github.com/streamthoughts/kafka-connect-client
-
Issue Tracker: https://github.com/streamthoughts/kafka-connect-client/issues
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
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