Kafka Connect Java Client

Java client library for Apache Kafka Connect REST Interface

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

io.streamthoughts
ArtifactId

ArtifactId

kafka-connect-client
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Kafka Connect Java Client
Java client library for Apache Kafka Connect REST Interface
Project URL

Project URL

https://github.com/streamthoughts/kafka-connect-client
Project Organization

Project Organization

streamthoughts
Source Code Management

Source Code Management

https://github.com/streamthoughts/kafka-connect-client

Download kafka-connect-client

How to add to project

<!-- https://jarcasting.com/artifacts/io.streamthoughts/kafka-connect-client/ -->
<dependency>
    <groupId>io.streamthoughts</groupId>
    <artifactId>kafka-connect-client</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.streamthoughts/kafka-connect-client/
implementation 'io.streamthoughts:kafka-connect-client:0.1.0'
// https://jarcasting.com/artifacts/io.streamthoughts/kafka-connect-client/
implementation ("io.streamthoughts:kafka-connect-client:0.1.0")
'io.streamthoughts:kafka-connect-client:jar:0.1.0'
<dependency org="io.streamthoughts" name="kafka-connect-client" rev="0.1.0">
  <artifact name="kafka-connect-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.streamthoughts', module='kafka-connect-client', version='0.1.0')
)
libraryDependencies += "io.streamthoughts" % "kafka-connect-client" % "0.1.0"
[io.streamthoughts/kafka-connect-client "0.1.0"]

Dependencies

compile (9)

Group / Artifact Type Version
com.squareup.okhttp3 : okhttp jar 4.9.0
com.squareup.okhttp3 : logging-interceptor jar 4.9.0
javax.annotation : javax.annotation-api jar 1.3.2
com.google.code.gson : gson jar 2.8.6
io.gsonfire : gson-fire jar 1.8.5
com.google.code.findbugs : jsr305 jar 3.0.2
org.slf4j : slf4j-api jar 1.7.28
io.swagger : swagger-annotations jar 1.6.2
org.mock-server : mockserver-junit-jupiter jar 5.11.2

test (8)

Group / Artifact Type Version
org.hamcrest : hamcrest-junit jar 2.0.0.0
ch.qos.logback : logback-classic jar 1.2.3
org.junit.platform : junit-platform-launcher jar 1.7.1
org.junit.jupiter : junit-jupiter-engine jar 5.8.0-M1
org.junit.vintage : junit-vintage-engine jar 5.8.0-M1
org.testcontainers : kafka jar 1.15.2
org.testcontainers : junit-jupiter jar 1.15.2
org.mockito : mockito-all jar 1.10.19

Project Modules

There are no modules declared in this project.

Java client library for Kafka Connect REST Interface

๐Ÿš€ Quickstart

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>

Build the project

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

Code Examples

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();

๐Ÿ™ 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!

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

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

io.streamthoughts

StreamThoughts

The leading French start-up in event streaming.

Versions

Version
0.1.0