use of org.sourcelab.kafka.connect.apiclient.Configuration in project akhq by tchiotludo.
the class KafkaModule method getConnectRestClient.
public Map<String, KafkaConnectClient> getConnectRestClient(String clusterId) {
if (!this.connectRestClient.containsKey(clusterId)) {
Connection connection = this.getConnection(clusterId);
if (connection.getConnect() != null && !connection.getConnect().isEmpty()) {
Map<String, KafkaConnectClient> mapConnects = new HashMap<>();
connection.getConnect().forEach(connect -> {
URIBuilder uri = URIBuilder.fromString(connect.getUrl().toString());
Configuration configuration = new Configuration(uri.toNormalizedURI(false).toString());
if (connect.getBasicAuthUsername() != null) {
configuration.useBasicAuth(connect.getBasicAuthUsername(), connect.getBasicAuthPassword());
}
if (connect.getSslTrustStore() != null) {
configuration.useTrustStore(new File(connect.getSslTrustStore()), connect.getSslTrustStorePassword());
}
if (connect.getSslKeyStore() != null) {
configuration.useKeyStore(new File(connect.getSslKeyStore()), connect.getSslKeyStorePassword());
}
mapConnects.put(connect.getName(), new KafkaConnectClient(configuration));
});
this.connectRestClient.put(clusterId, mapConnects);
}
}
return this.connectRestClient.get(clusterId);
}
Aggregations