This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit de3aa467ba60af415bbb395cf6a26f673913c5c5 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Feb 19 17:10:41 2021 +0100 CAMEL-16115 - Remove Camel-AWS-* components - AWS-MSK --- bom/camel-bom/pom.xml | 5 - components/camel-aws-msk/pom.xml | 72 ---- .../component/aws/msk/MSKComponentConfigurer.java | 113 ------- .../component/aws/msk/MSKEndpointConfigurer.java | 97 ------ .../component/aws/msk/MSKEndpointUriFactory.java | 74 ---- .../services/org/apache/camel/component.properties | 7 - .../services/org/apache/camel/component/aws-msk | 2 - .../org/apache/camel/configurer/aws-msk-component | 2 - .../org/apache/camel/configurer/aws-msk-endpoint | 2 - .../org/apache/camel/urifactory/aws-msk-endpoint | 2 - .../apache/camel/component/aws/msk/aws-msk.json | 52 --- .../src/main/docs/aws-msk-component.adoc | 180 ---------- .../camel/component/aws/msk/MSKComponent.java | 80 ----- .../aws/msk/MSKComponentVerifierExtension.java | 93 ----- .../camel/component/aws/msk/MSKConfiguration.java | 165 --------- .../camel/component/aws/msk/MSKConstants.java | 30 -- .../camel/component/aws/msk/MSKEndpoint.java | 123 ------- .../camel/component/aws/msk/MSKOperations.java | 25 -- .../camel/component/aws/msk/MSKProducer.java | 193 ----------- .../component/aws/msk/AmazonMSKClientMock.java | 75 ---- .../aws/msk/MSKComponentClientRegistryTest.java | 70 ---- .../aws/msk/MSKComponentConfigurationTest.java | 69 ---- .../aws/msk/MSKComponentVerifierExtensionTest.java | 76 ----- .../component/aws/msk/MSKProducerSpringTest.java | 119 ------- .../camel/component/aws/msk/MSKProducerTest.java | 135 -------- .../src/test/resources/log4j2.properties | 28 -- .../aws/msk/MSKComponentSpringTest-context.xml | 53 --- components/pom.xml | 1 - core/camel-allcomponents/pom.xml | 4 - .../component/ComponentsBuilderFactory.java | 16 +- .../dsl/AwsMskComponentBuilderFactory.java | 292 ---------------- .../builder/endpoint/StaticEndpointBuilders.java | 47 +-- .../endpoint/dsl/MSKEndpointBuilderFactory.java | 376 --------------------- parent/pom.xml | 5 - 34 files changed, 2 insertions(+), 2681 deletions(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index f7a13b9..9981cca 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -188,11 +188,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-aws-msk</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-aws-s3</artifactId> <version>${project.version}</version> </dependency> diff --git a/components/camel-aws-msk/pom.xml b/components/camel-aws-msk/pom.xml deleted file mode 100644 index 81c8e9e..0000000 --- a/components/camel-aws-msk/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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 - - 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. - ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.camel</groupId> - <artifactId>components</artifactId> - <version>3.9.0-SNAPSHOT</version> - </parent> - - <artifactId>camel-aws-msk</artifactId> - <packaging>jar</packaging> - - <name>Camel :: AWS MSK (deprecated)</name> - <description>A Camel Amazon MSK Web Service Component</description> - - <properties> - <deprecatedSince>3.8.0</deprecatedSince> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-support</artifactId> - </dependency> - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk-kafka</artifactId> - <version>${aws-java-sdk-version}</version> - </dependency> - - <!-- for testing --> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring-junit5</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-catalog</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKComponentConfigurer.java b/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKComponentConfigurer.java deleted file mode 100644 index e6275db..0000000 --- a/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKComponentConfigurer.java +++ /dev/null @@ -1,113 +0,0 @@ -/* Generated by camel build tools - do NOT edit this file! */ -package org.apache.camel.component.aws.msk; - -import java.util.Map; - -import org.apache.camel.CamelContext; -import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; -import org.apache.camel.spi.PropertyConfigurerGetter; -import org.apache.camel.spi.ConfigurerStrategy; -import org.apache.camel.spi.GeneratedPropertyConfigurer; -import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.support.component.PropertyConfigurerSupport; - -/** - * Generated by camel build tools - do NOT edit this file! - */ -@SuppressWarnings("unchecked") -public class MSKComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { - - private org.apache.camel.component.aws.msk.MSKConfiguration getOrCreateConfiguration(MSKComponent target) { - if (target.getConfiguration() == null) { - target.setConfiguration(new org.apache.camel.component.aws.msk.MSKConfiguration()); - } - return target.getConfiguration(); - } - - @Override - public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - MSKComponent target = (MSKComponent) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "accesskey": - case "accessKey": getOrCreateConfiguration(target).setAccessKey(property(camelContext, java.lang.String.class, value)); return true; - case "autodiscoverclient": - case "autoDiscoverClient": getOrCreateConfiguration(target).setAutoDiscoverClient(property(camelContext, boolean.class, value)); return true; - case "autowiredenabled": - case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true; - case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.aws.msk.MSKConfiguration.class, value)); return true; - case "lazystartproducer": - case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; - case "mskclient": - case "mskClient": getOrCreateConfiguration(target).setMskClient(property(camelContext, com.amazonaws.services.kafka.AWSKafka.class, value)); return true; - case "operation": getOrCreateConfiguration(target).setOperation(property(camelContext, org.apache.camel.component.aws.msk.MSKOperations.class, value)); return true; - case "proxyhost": - case "proxyHost": getOrCreateConfiguration(target).setProxyHost(property(camelContext, java.lang.String.class, value)); return true; - case "proxyport": - case "proxyPort": getOrCreateConfiguration(target).setProxyPort(property(camelContext, java.lang.Integer.class, value)); return true; - case "proxyprotocol": - case "proxyProtocol": getOrCreateConfiguration(target).setProxyProtocol(property(camelContext, com.amazonaws.Protocol.class, value)); return true; - case "region": getOrCreateConfiguration(target).setRegion(property(camelContext, java.lang.String.class, value)); return true; - case "secretkey": - case "secretKey": getOrCreateConfiguration(target).setSecretKey(property(camelContext, java.lang.String.class, value)); return true; - default: return false; - } - } - - @Override - public Class<?> getOptionType(String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "accesskey": - case "accessKey": return java.lang.String.class; - case "autodiscoverclient": - case "autoDiscoverClient": return boolean.class; - case "autowiredenabled": - case "autowiredEnabled": return boolean.class; - case "configuration": return org.apache.camel.component.aws.msk.MSKConfiguration.class; - case "lazystartproducer": - case "lazyStartProducer": return boolean.class; - case "mskclient": - case "mskClient": return com.amazonaws.services.kafka.AWSKafka.class; - case "operation": return org.apache.camel.component.aws.msk.MSKOperations.class; - case "proxyhost": - case "proxyHost": return java.lang.String.class; - case "proxyport": - case "proxyPort": return java.lang.Integer.class; - case "proxyprotocol": - case "proxyProtocol": return com.amazonaws.Protocol.class; - case "region": return java.lang.String.class; - case "secretkey": - case "secretKey": return java.lang.String.class; - default: return null; - } - } - - @Override - public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - MSKComponent target = (MSKComponent) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "accesskey": - case "accessKey": return getOrCreateConfiguration(target).getAccessKey(); - case "autodiscoverclient": - case "autoDiscoverClient": return getOrCreateConfiguration(target).isAutoDiscoverClient(); - case "autowiredenabled": - case "autowiredEnabled": return target.isAutowiredEnabled(); - case "configuration": return target.getConfiguration(); - case "lazystartproducer": - case "lazyStartProducer": return target.isLazyStartProducer(); - case "mskclient": - case "mskClient": return getOrCreateConfiguration(target).getMskClient(); - case "operation": return getOrCreateConfiguration(target).getOperation(); - case "proxyhost": - case "proxyHost": return getOrCreateConfiguration(target).getProxyHost(); - case "proxyport": - case "proxyPort": return getOrCreateConfiguration(target).getProxyPort(); - case "proxyprotocol": - case "proxyProtocol": return getOrCreateConfiguration(target).getProxyProtocol(); - case "region": return getOrCreateConfiguration(target).getRegion(); - case "secretkey": - case "secretKey": return getOrCreateConfiguration(target).getSecretKey(); - default: return null; - } - } -} - diff --git a/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKEndpointConfigurer.java b/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKEndpointConfigurer.java deleted file mode 100644 index 8def06c..0000000 --- a/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKEndpointConfigurer.java +++ /dev/null @@ -1,97 +0,0 @@ -/* Generated by camel build tools - do NOT edit this file! */ -package org.apache.camel.component.aws.msk; - -import java.util.Map; - -import org.apache.camel.CamelContext; -import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; -import org.apache.camel.spi.PropertyConfigurerGetter; -import org.apache.camel.spi.ConfigurerStrategy; -import org.apache.camel.spi.GeneratedPropertyConfigurer; -import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.support.component.PropertyConfigurerSupport; - -/** - * Generated by camel build tools - do NOT edit this file! - */ -@SuppressWarnings("unchecked") -public class MSKEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { - - @Override - public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - MSKEndpoint target = (MSKEndpoint) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "accesskey": - case "accessKey": target.getConfiguration().setAccessKey(property(camelContext, java.lang.String.class, value)); return true; - case "autodiscoverclient": - case "autoDiscoverClient": target.getConfiguration().setAutoDiscoverClient(property(camelContext, boolean.class, value)); return true; - case "lazystartproducer": - case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; - case "mskclient": - case "mskClient": target.getConfiguration().setMskClient(property(camelContext, com.amazonaws.services.kafka.AWSKafka.class, value)); return true; - case "operation": target.getConfiguration().setOperation(property(camelContext, org.apache.camel.component.aws.msk.MSKOperations.class, value)); return true; - case "proxyhost": - case "proxyHost": target.getConfiguration().setProxyHost(property(camelContext, java.lang.String.class, value)); return true; - case "proxyport": - case "proxyPort": target.getConfiguration().setProxyPort(property(camelContext, java.lang.Integer.class, value)); return true; - case "proxyprotocol": - case "proxyProtocol": target.getConfiguration().setProxyProtocol(property(camelContext, com.amazonaws.Protocol.class, value)); return true; - case "region": target.getConfiguration().setRegion(property(camelContext, java.lang.String.class, value)); return true; - case "secretkey": - case "secretKey": target.getConfiguration().setSecretKey(property(camelContext, java.lang.String.class, value)); return true; - default: return false; - } - } - - @Override - public Class<?> getOptionType(String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "accesskey": - case "accessKey": return java.lang.String.class; - case "autodiscoverclient": - case "autoDiscoverClient": return boolean.class; - case "lazystartproducer": - case "lazyStartProducer": return boolean.class; - case "mskclient": - case "mskClient": return com.amazonaws.services.kafka.AWSKafka.class; - case "operation": return org.apache.camel.component.aws.msk.MSKOperations.class; - case "proxyhost": - case "proxyHost": return java.lang.String.class; - case "proxyport": - case "proxyPort": return java.lang.Integer.class; - case "proxyprotocol": - case "proxyProtocol": return com.amazonaws.Protocol.class; - case "region": return java.lang.String.class; - case "secretkey": - case "secretKey": return java.lang.String.class; - default: return null; - } - } - - @Override - public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - MSKEndpoint target = (MSKEndpoint) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "accesskey": - case "accessKey": return target.getConfiguration().getAccessKey(); - case "autodiscoverclient": - case "autoDiscoverClient": return target.getConfiguration().isAutoDiscoverClient(); - case "lazystartproducer": - case "lazyStartProducer": return target.isLazyStartProducer(); - case "mskclient": - case "mskClient": return target.getConfiguration().getMskClient(); - case "operation": return target.getConfiguration().getOperation(); - case "proxyhost": - case "proxyHost": return target.getConfiguration().getProxyHost(); - case "proxyport": - case "proxyPort": return target.getConfiguration().getProxyPort(); - case "proxyprotocol": - case "proxyProtocol": return target.getConfiguration().getProxyProtocol(); - case "region": return target.getConfiguration().getRegion(); - case "secretkey": - case "secretKey": return target.getConfiguration().getSecretKey(); - default: return null; - } - } -} - diff --git a/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKEndpointUriFactory.java b/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKEndpointUriFactory.java deleted file mode 100644 index 073a929..0000000 --- a/components/camel-aws-msk/src/generated/java/org/apache/camel/component/aws/msk/MSKEndpointUriFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -/* Generated by camel build tools - do NOT edit this file! */ -package org.apache.camel.component.aws.msk; - -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.camel.spi.EndpointUriFactory; - -/** - * Generated by camel build tools - do NOT edit this file! - */ -public class MSKEndpointUriFactory extends org.apache.camel.support.component.EndpointUriFactorySupport implements EndpointUriFactory { - - private static final String BASE = ":label"; - - private static final Set<String> PROPERTY_NAMES; - private static final Set<String> SECRET_PROPERTY_NAMES; - static { - Set<String> props = new HashSet<>(11); - props.add("autoDiscoverClient"); - props.add("proxyPort"); - props.add("lazyStartProducer"); - props.add("proxyProtocol"); - props.add("secretKey"); - props.add("accessKey"); - props.add("label"); - props.add("region"); - props.add("mskClient"); - props.add("operation"); - props.add("proxyHost"); - PROPERTY_NAMES = Collections.unmodifiableSet(props); - Set<String> secretProps = new HashSet<>(2); - secretProps.add("secretKey"); - secretProps.add("accessKey"); - SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps); - } - - @Override - public boolean isEnabled(String scheme) { - return "aws-msk".equals(scheme); - } - - @Override - public String buildUri(String scheme, Map<String, Object> properties, boolean encode) throws URISyntaxException { - String syntax = scheme + BASE; - String uri = syntax; - - Map<String, Object> copy = new HashMap<>(properties); - - uri = buildPathParameter(syntax, uri, "label", null, true, copy); - uri = buildQueryParameters(uri, copy, encode); - return uri; - } - - @Override - public Set<String> propertyNames() { - return PROPERTY_NAMES; - } - - @Override - public Set<String> secretPropertyNames() { - return SECRET_PROPERTY_NAMES; - } - - @Override - public boolean isLenientProperties() { - return false; - } -} - diff --git a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/component.properties b/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/component.properties deleted file mode 100644 index 095f174..0000000 --- a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/component.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -components=aws-msk -groupId=org.apache.camel -artifactId=camel-aws-msk -version=3.9.0-SNAPSHOT -projectName=Camel :: AWS MSK (deprecated) -projectDescription=A Camel Amazon MSK Web Service Component diff --git a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/component/aws-msk b/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/component/aws-msk deleted file mode 100644 index 5e97345..0000000 --- a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/component/aws-msk +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.aws.msk.MSKComponent diff --git a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-msk-component b/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-msk-component deleted file mode 100644 index ce12b0a..0000000 --- a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-msk-component +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.aws.msk.MSKComponentConfigurer diff --git a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-msk-endpoint b/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-msk-endpoint deleted file mode 100644 index 76b8328..0000000 --- a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-msk-endpoint +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.aws.msk.MSKEndpointConfigurer diff --git a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/urifactory/aws-msk-endpoint b/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/urifactory/aws-msk-endpoint deleted file mode 100644 index ad68737..0000000 --- a/components/camel-aws-msk/src/generated/resources/META-INF/services/org/apache/camel/urifactory/aws-msk-endpoint +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.aws.msk.MSKEndpointUriFactory diff --git a/components/camel-aws-msk/src/generated/resources/org/apache/camel/component/aws/msk/aws-msk.json b/components/camel-aws-msk/src/generated/resources/org/apache/camel/component/aws/msk/aws-msk.json deleted file mode 100644 index 74841e4..0000000 --- a/components/camel-aws-msk/src/generated/resources/org/apache/camel/component/aws/msk/aws-msk.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "component": { - "kind": "component", - "name": "aws-msk", - "title": "AWS Managed Streaming for Apache Kafka (MSK)", - "description": "Manage AWS MSK instances.", - "deprecated": true, - "deprecatedSince": "3.8.0", - "firstVersion": "3.0.0", - "label": "cloud,messaging", - "javaType": "org.apache.camel.component.aws.msk.MSKComponent", - "supportLevel": "Stable", - "groupId": "org.apache.camel", - "artifactId": "camel-aws-msk", - "version": "3.9.0-SNAPSHOT", - "scheme": "aws-msk", - "extendsScheme": "", - "syntax": "aws-msk:label", - "async": false, - "api": false, - "consumerOnly": false, - "producerOnly": true, - "lenientProperties": false - }, - "componentProperties": { - "autoDiscoverClient": { "kind": "property", "displayName": "Auto Discover Client", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "Setting the autoDiscoverClient mechanism, if true, the component will look for a client instan [...] - "accessKey": { "kind": "property", "displayName": "Access Key", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "Amazon AWS Access Key" }, - "configuration": { "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws.msk.MSKConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The component configuration" }, - "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] - "mskClient": { "kind": "property", "displayName": "Msk Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.amazonaws.services.kafka.AWSKafka", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To use a existing configured AWS MSK as client" }, - "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws.msk.MSKOperations", "enum": [ "listClusters", "createCluster", "deleteCluster", "describeCluster" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "desc [...] - "proxyHost": { "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the MSK client" }, - "proxyPort": { "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the MSK client" }, - "proxyProtocol": { "kind": "property", "displayName": "Proxy Protocol", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "com.amazonaws.Protocol", "enum": [ "HTTP", "HTTPS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "HTTPS", "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To define a proxy protocol when instantiating the MSK client" }, - "region": { "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "The region in which MSK client needs to work. When using this parameter, the configuration will expect the capitalized name of the region [...] - "secretKey": { "kind": "property", "displayName": "Secret Key", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }, - "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] - }, - "properties": { - "label": { "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "Logical name" }, - "autoDiscoverClient": { "kind": "parameter", "displayName": "Auto Discover Client", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "Setting the autoDiscoverClient mechanism, if true, the component will look for a client insta [...] - "accessKey": { "kind": "parameter", "displayName": "Access Key", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "Amazon AWS Access Key" }, - "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during sta [...] - "mskClient": { "kind": "parameter", "displayName": "Msk Client", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.amazonaws.services.kafka.AWSKafka", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To use a existing configured AWS MSK as client" }, - "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws.msk.MSKOperations", "enum": [ "listClusters", "createCluster", "deleteCluster", "describeCluster" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "des [...] - "proxyHost": { "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the MSK client" }, - "proxyPort": { "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the MSK client" }, - "proxyProtocol": { "kind": "parameter", "displayName": "Proxy Protocol", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "com.amazonaws.Protocol", "enum": [ "HTTP", "HTTPS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "HTTPS", "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "To define a proxy protocol when instantiating the MSK client" }, - "region": { "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "The region in which MSK client needs to work. When using this parameter, the configuration will expect the capitalized name of the region [...] - "secretKey": { "kind": "parameter", "displayName": "Secret Key", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.msk.MSKConfiguration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" } - } -} diff --git a/components/camel-aws-msk/src/main/docs/aws-msk-component.adoc b/components/camel-aws-msk/src/main/docs/aws-msk-component.adoc deleted file mode 100644 index ae94479..0000000 --- a/components/camel-aws-msk/src/main/docs/aws-msk-component.adoc +++ /dev/null @@ -1,180 +0,0 @@ -[[aws-msk-component]] -= AWS Managed Streaming for Apache Kafka (MSK) Component (deprecated) -:docTitle: AWS Managed Streaming for Apache Kafka (MSK) -:artifactId: camel-aws-msk -:description: Manage AWS MSK instances. -:since: 3.0 -:supportLevel: Stable-deprecated -:deprecated: *deprecated* -:component-header: Only producer is supported -include::{cq-version}@camel-quarkus:ROOT:partial$reference/components/aws-msk.adoc[opts=optional] -//Manually maintained attributes -:group: AWS - -*Since Camel {since}* - -*{component-header}* - -The AWS MSK component supports create, run, start, stop and terminate -https://aws.amazon.com/msk/[AWS MSK] instances. - -Prerequisites - -You must have a valid Amazon Web Services developer account, and be -signed up to use Amazon MSK. More information is available at -https://aws.amazon.com/msk/[Amazon MSK]. - -== URI Format - -[source,java] -------------------------- -aws-msk://label[?options] -------------------------- - -You can append query options to the URI in the following format, -?options=value&option2=value&... - -== URI Options - - -// component options: START -The AWS Managed Streaming for Apache Kafka (MSK) component supports 12 options, which are listed below. - - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean -| *accessKey* (producer) | Amazon AWS Access Key | | String -| *configuration* (producer) | The component configuration | | MSKConfiguration -| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *mskClient* (producer) | To use a existing configured AWS MSK as client | | AWSKafka -| *operation* (producer) | *Required* The operation to perform. There are 4 enums and the value can be one of: listClusters, createCluster, deleteCluster, describeCluster | | MSKOperations -| *proxyHost* (producer) | To define a proxy host when instantiating the MSK client | | String -| *proxyPort* (producer) | To define a proxy port when instantiating the MSK client | | Integer -| *proxyProtocol* (producer) | To define a proxy protocol when instantiating the MSK client. There are 2 enums and the value can be one of: HTTP, HTTPS | HTTPS | Protocol -| *region* (producer) | The region in which MSK client needs to work. When using this parameter, the configuration will expect the capitalized name of the region (for example AP_EAST_1) You'll need to use the name Regions.EU_WEST_1.name() | | String -| *secretKey* (producer) | Amazon AWS Secret Key | | String -| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean -|=== -// component options: END - - - - -// endpoint options: START -The AWS Managed Streaming for Apache Kafka (MSK) endpoint is configured using URI syntax: - ----- -aws-msk:label ----- - -with the following path and query parameters: - -=== Path Parameters (1 parameters): - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *label* | *Required* Logical name | | String -|=== - - -=== Query Parameters (10 parameters): - - -[width="100%",cols="2,5,^1,2",options="header"] -|=== -| Name | Description | Default | Type -| *autoDiscoverClient* (common) | Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry automatically otherwise it will skip that checking. | true | boolean -| *accessKey* (producer) | Amazon AWS Access Key | | String -| *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] -| *mskClient* (producer) | To use a existing configured AWS MSK as client | | AWSKafka -| *operation* (producer) | *Required* The operation to perform. There are 4 enums and the value can be one of: listClusters, createCluster, deleteCluster, describeCluster | | MSKOperations -| *proxyHost* (producer) | To define a proxy host when instantiating the MSK client | | String -| *proxyPort* (producer) | To define a proxy port when instantiating the MSK client | | Integer -| *proxyProtocol* (producer) | To define a proxy protocol when instantiating the MSK client. There are 2 enums and the value can be one of: HTTP, HTTPS | HTTPS | Protocol -| *region* (producer) | The region in which MSK client needs to work. When using this parameter, the configuration will expect the capitalized name of the region (for example AP_EAST_1) You'll need to use the name Regions.EU_WEST_1.name() | | String -| *secretKey* (producer) | Amazon AWS Secret Key | | String -|=== -// endpoint options: END - - - - - -Required MSK component options - -You have to provide the amazonMskClient in the -Registry or your accessKey and secretKey to access -the https://aws.amazon.com/msk/[Amazon MSK] service. - -== Usage - -=== Message headers evaluated by the MSK producer - -[width="100%",cols="10%,10%,80%",options="header",] -|======================================================================= -|Header |Type |Description - -|`CamelAwsMSKOperation` |`String` |The operation to perform - -|`CamelAwsMSKClusterFilter` |`String` |The cluster name filter for list operation - -|`CamelAwsMSKClusterName` |`String` |The cluster name for list and create operation - -|`CamelAwsMSKClusterArn` |`String` |The cluster arn for delete operation - -|`CamelAwsMSKClusterKafkaVersion` |`String` | The Kafka for the cluster during create operation - -|`CamelAwsMSKBrokerNodesNumber` |`Integer`| The number of nodes for the cluster during create operation - -|`CamelAwsMSKBrokerNodesGroupInfo` |`com.amazonaws.services.kafka.model.BrokerNodeGroupInfo`| The Broker nodes group info to provide during the create operation -|======================================================================= - -=== MSK Producer operations - -Camel-AWS MSK component provides the following operation on the producer side: - -- listClusters -- createCluster -- deleteCluster -- describeCluster - -== Producer Examples - -- listBrokers: this operation will list the available MSK Brokers in AWS - -[source,java] --------------------------------------------------------------------------------- -from("direct:listClusters") - .to("aws-msk://test?mskClient=#amazonMskClient&operation=listClusters") --------------------------------------------------------------------------------- - -== Automatic detection of AWSKafka client in registry - -The component is capable of detecting the presence of an AWSKafka bean into the registry. -If it's the only instance of that type it will be used as client and you won't have to define it as uri parameter. -This may be really useful for smarter configuration of the endpoint. - -Dependencies - -Maven users will need to add the following dependency to their pom.xml. - -*pom.xml* - -[source,xml] ---------------------------------------- -<dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-aws-msk</artifactId> - <version>${camel-version}</version> -</dependency> ---------------------------------------- - -where `$\{camel-version}` must be replaced by the actual version of Camel. - - -include::camel-spring-boot::page$aws-msk-starter.adoc[] diff --git a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKComponent.java b/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKComponent.java deleted file mode 100644 index 03039f0..0000000 --- a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKComponent.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import java.util.Map; -import java.util.Set; - -import com.amazonaws.services.kafka.AWSKafka; -import org.apache.camel.CamelContext; -import org.apache.camel.Endpoint; -import org.apache.camel.spi.Metadata; -import org.apache.camel.spi.annotations.Component; -import org.apache.camel.support.DefaultComponent; - -/** - * For working with Amazon MSK. - */ -@Component("aws-msk") -public class MSKComponent extends DefaultComponent { - - @Metadata - private MSKConfiguration configuration = new MSKConfiguration(); - - public MSKComponent() { - this(null); - } - - public MSKComponent(CamelContext context) { - super(context); - - registerExtension(new MSKComponentVerifierExtension()); - } - - @Override - protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - MSKConfiguration configuration = this.configuration != null ? this.configuration.copy() : new MSKConfiguration(); - MSKEndpoint endpoint = new MSKEndpoint(uri, this, configuration); - setProperties(endpoint, parameters); - if (endpoint.getConfiguration().isAutoDiscoverClient()) { - checkAndSetRegistryClient(configuration); - } - if (configuration.getMskClient() == null - && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { - throw new IllegalArgumentException("Amazon msk client or accessKey and secretKey must be specified"); - } - return endpoint; - } - - public MSKConfiguration getConfiguration() { - return configuration; - } - - /** - * The component configuration - */ - public void setConfiguration(MSKConfiguration configuration) { - this.configuration = configuration; - } - - private void checkAndSetRegistryClient(MSKConfiguration configuration) { - Set<AWSKafka> clients = getCamelContext().getRegistry().findByType(AWSKafka.class); - if (clients.size() == 1) { - configuration.setMskClient(clients.stream().findFirst().get()); - } - } -} diff --git a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKComponentVerifierExtension.java b/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKComponentVerifierExtension.java deleted file mode 100644 index 073af26..0000000 --- a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKComponentVerifierExtension.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import java.util.Map; - -import com.amazonaws.SdkClientException; -import com.amazonaws.auth.AWSCredentials; -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.regions.Regions; -import com.amazonaws.services.kafka.AWSKafka; -import com.amazonaws.services.kafka.AWSKafkaClientBuilder; -import com.amazonaws.services.kafka.model.ListClustersRequest; -import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension; -import org.apache.camel.component.extension.verifier.ResultBuilder; -import org.apache.camel.component.extension.verifier.ResultErrorBuilder; -import org.apache.camel.component.extension.verifier.ResultErrorHelper; - -public class MSKComponentVerifierExtension extends DefaultComponentVerifierExtension { - - public MSKComponentVerifierExtension() { - this("aws-msk"); - } - - public MSKComponentVerifierExtension(String scheme) { - super(scheme); - } - - // ********************************* - // Parameters validation - // ********************************* - - @Override - protected Result verifyParameters(Map<String, Object> parameters) { - - ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS) - .error(ResultErrorHelper.requiresOption("accessKey", parameters)) - .error(ResultErrorHelper.requiresOption("secretKey", parameters)) - .error(ResultErrorHelper.requiresOption("region", parameters)); - - // Validate using the catalog - - super.verifyParametersAgainstCatalog(builder, parameters); - - return builder.build(); - } - - // ********************************* - // Connectivity validation - // ********************************* - - @Override - protected Result verifyConnectivity(Map<String, Object> parameters) { - ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY); - - try { - MSKConfiguration configuration = setProperties(new MSKConfiguration(), parameters); - AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); - AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); - ListClustersRequest request = new ListClustersRequest(); - AWSKafka client = AWSKafkaClientBuilder.standard().withCredentials(credentialsProvider) - .withRegion(Regions.valueOf(configuration.getRegion())).build(); - client.listClusters(request); - } catch (SdkClientException e) { - ResultErrorBuilder errorBuilder - = ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage()) - .detail("aws_mks_exception_message", e.getMessage()) - .detail(VerificationError.ExceptionAttribute.EXCEPTION_CLASS, e.getClass().getName()) - .detail(VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE, e); - - builder.error(errorBuilder.build()); - } catch (Exception e) { - builder.error(ResultErrorBuilder.withException(e).build()); - } - return builder.build(); - } -} diff --git a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKConfiguration.java b/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKConfiguration.java deleted file mode 100644 index 3e7022381..0000000 --- a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKConfiguration.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import com.amazonaws.Protocol; -import com.amazonaws.services.kafka.AWSKafka; -import org.apache.camel.RuntimeCamelException; -import org.apache.camel.spi.Metadata; -import org.apache.camel.spi.UriParam; -import org.apache.camel.spi.UriParams; -import org.apache.camel.spi.UriPath; - -@UriParams -public class MSKConfiguration implements Cloneable { - - @UriPath(description = "Logical name") - @Metadata(required = true) - private String label; - @UriParam(label = "producer") - private AWSKafka mskClient; - @UriParam(label = "producer", secret = true) - private String accessKey; - @UriParam(label = "producer", secret = true) - private String secretKey; - @UriParam(label = "producer") - @Metadata(required = true) - private MSKOperations operation; - @UriParam(enums = "HTTP,HTTPS", defaultValue = "HTTPS") - private Protocol proxyProtocol = Protocol.HTTPS; - @UriParam(label = "producer") - private String proxyHost; - @UriParam(label = "producer") - private Integer proxyPort; - @UriParam - private String region; - @UriParam(label = "common", defaultValue = "true") - private boolean autoDiscoverClient = true; - - public AWSKafka getMskClient() { - return mskClient; - } - - /** - * To use a existing configured AWS MSK as client - */ - public void setMskClient(AWSKafka mskClient) { - this.mskClient = mskClient; - } - - public String getAccessKey() { - return accessKey; - } - - /** - * Amazon AWS Access Key - */ - public void setAccessKey(String accessKey) { - this.accessKey = accessKey; - } - - public String getSecretKey() { - return secretKey; - } - - /** - * Amazon AWS Secret Key - */ - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } - - public MSKOperations getOperation() { - return operation; - } - - /** - * The operation to perform - */ - public void setOperation(MSKOperations operation) { - this.operation = operation; - } - - public Protocol getProxyProtocol() { - return proxyProtocol; - } - - /** - * To define a proxy protocol when instantiating the MSK client - */ - public void setProxyProtocol(Protocol proxyProtocol) { - this.proxyProtocol = proxyProtocol; - } - - public String getProxyHost() { - return proxyHost; - } - - /** - * To define a proxy host when instantiating the MSK client - */ - public void setProxyHost(String proxyHost) { - this.proxyHost = proxyHost; - } - - public Integer getProxyPort() { - return proxyPort; - } - - /** - * To define a proxy port when instantiating the MSK client - */ - public void setProxyPort(Integer proxyPort) { - this.proxyPort = proxyPort; - } - - public String getRegion() { - return region; - } - - /** - * The region in which MSK client needs to work. When using this parameter, the configuration will expect the - * capitalized name of the region (for example AP_EAST_1) You'll need to use the name Regions.EU_WEST_1.name() - */ - public void setRegion(String region) { - this.region = region; - } - - public boolean isAutoDiscoverClient() { - return autoDiscoverClient; - } - - /** - * Setting the autoDiscoverClient mechanism, if true, the component will look for a client instance in the registry - * automatically otherwise it will skip that checking. - */ - public void setAutoDiscoverClient(boolean autoDiscoverClient) { - this.autoDiscoverClient = autoDiscoverClient; - } - - // ************************************************* - // - // ************************************************* - - public MSKConfiguration copy() { - try { - return (MSKConfiguration) super.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeCamelException(e); - } - } -} diff --git a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKConstants.java b/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKConstants.java deleted file mode 100644 index 56d9496..0000000 --- a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKConstants.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -/** - * Constants used in Camel AWS MSK module - */ -public interface MSKConstants { - String OPERATION = "CamelAwsMSKOperation"; - String CLUSTERS_FILTER = "CamelAwsMSKClusterFilter"; - String CLUSTER_NAME = "CamelAwsMSKClusterName"; - String CLUSTER_ARN = "CamelAwsMSKClusterArn"; - String CLUSTER_KAFKA_VERSION = "CamelAwsMSKClusterKafkaVersion"; - String BROKER_NODES_NUMBER = "CamelAwsMSKBrokerNodesNumber"; - String BROKER_NODES_GROUP_INFO = "CamelAwsMSKBrokerNodesGroupInfo"; -} diff --git a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKEndpoint.java b/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKEndpoint.java deleted file mode 100644 index 8213638..0000000 --- a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKEndpoint.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import com.amazonaws.ClientConfiguration; -import com.amazonaws.auth.AWSCredentials; -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.regions.Regions; -import com.amazonaws.services.kafka.AWSKafka; -import com.amazonaws.services.kafka.AWSKafkaClientBuilder; -import org.apache.camel.Category; -import org.apache.camel.Component; -import org.apache.camel.Consumer; -import org.apache.camel.Processor; -import org.apache.camel.Producer; -import org.apache.camel.spi.UriEndpoint; -import org.apache.camel.spi.UriParam; -import org.apache.camel.support.ScheduledPollEndpoint; -import org.apache.camel.util.ObjectHelper; - -/** - * Manage AWS MSK instances. - */ -@UriEndpoint(firstVersion = "3.0.0", scheme = "aws-msk", title = "AWS Managed Streaming for Apache Kafka (MSK)", - syntax = "aws-msk:label", producerOnly = true, category = { Category.CLOUD, Category.MESSAGING }) -public class MSKEndpoint extends ScheduledPollEndpoint { - - private AWSKafka mskClient; - - @UriParam - private MSKConfiguration configuration; - - public MSKEndpoint(String uri, Component component, MSKConfiguration configuration) { - super(uri, component); - this.configuration = configuration; - } - - @Override - public Consumer createConsumer(Processor processor) throws Exception { - throw new UnsupportedOperationException("You cannot receive messages from this endpoint"); - } - - @Override - public Producer createProducer() throws Exception { - return new MSKProducer(this); - } - - @Override - public void doStart() throws Exception { - super.doStart(); - - mskClient = configuration.getMskClient() != null ? configuration.getMskClient() : createMSKClient(); - } - - @Override - public void doStop() throws Exception { - if (ObjectHelper.isEmpty(configuration.getMskClient())) { - if (mskClient != null) { - mskClient.shutdown(); - } - } - super.doStop(); - } - - public MSKConfiguration getConfiguration() { - return configuration; - } - - public AWSKafka getMskClient() { - return mskClient; - } - - AWSKafka createMSKClient() { - AWSKafka client = null; - ClientConfiguration clientConfiguration = null; - AWSKafkaClientBuilder clientBuilder = null; - boolean isClientConfigFound = false; - if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { - clientConfiguration = new ClientConfiguration(); - clientConfiguration.setProxyProtocol(configuration.getProxyProtocol()); - clientConfiguration.setProxyHost(configuration.getProxyHost()); - clientConfiguration.setProxyPort(configuration.getProxyPort()); - isClientConfigFound = true; - } - if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) { - AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); - AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); - if (isClientConfigFound) { - clientBuilder = AWSKafkaClientBuilder.standard().withClientConfiguration(clientConfiguration) - .withCredentials(credentialsProvider); - } else { - clientBuilder = AWSKafkaClientBuilder.standard().withCredentials(credentialsProvider); - } - } else { - if (isClientConfigFound) { - clientBuilder = AWSKafkaClientBuilder.standard(); - } else { - clientBuilder = AWSKafkaClientBuilder.standard().withClientConfiguration(clientConfiguration); - } - } - if (ObjectHelper.isNotEmpty(configuration.getRegion())) { - clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); - } - client = clientBuilder.build(); - return client; - } -} diff --git a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKOperations.java b/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKOperations.java deleted file mode 100644 index 2a6b90e..0000000 --- a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKOperations.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -public enum MSKOperations { - - listClusters, - createCluster, - deleteCluster, - describeCluster -} diff --git a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKProducer.java b/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKProducer.java deleted file mode 100644 index 4750a40..0000000 --- a/components/camel-aws-msk/src/main/java/org/apache/camel/component/aws/msk/MSKProducer.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import com.amazonaws.AmazonServiceException; -import com.amazonaws.services.kafka.AWSKafka; -import com.amazonaws.services.kafka.model.BrokerNodeGroupInfo; -import com.amazonaws.services.kafka.model.CreateClusterRequest; -import com.amazonaws.services.kafka.model.CreateClusterResult; -import com.amazonaws.services.kafka.model.DeleteClusterRequest; -import com.amazonaws.services.kafka.model.DeleteClusterResult; -import com.amazonaws.services.kafka.model.DescribeClusterRequest; -import com.amazonaws.services.kafka.model.DescribeClusterResult; -import com.amazonaws.services.kafka.model.ListClustersRequest; -import com.amazonaws.services.kafka.model.ListClustersResult; -import org.apache.camel.Endpoint; -import org.apache.camel.Exchange; -import org.apache.camel.Message; -import org.apache.camel.support.DefaultProducer; -import org.apache.camel.util.ObjectHelper; -import org.apache.camel.util.URISupport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A Producer which sends messages to the Amazon MSK Service <a href="http://aws.amazon.com/msk/">AWS MSK</a> - */ -public class MSKProducer extends DefaultProducer { - - private static final Logger LOG = LoggerFactory.getLogger(MSKProducer.class); - - private transient String mskProducerToString; - - public MSKProducer(Endpoint endpoint) { - super(endpoint); - } - - @Override - public void process(Exchange exchange) throws Exception { - switch (determineOperation(exchange)) { - case listClusters: - listClusters(getEndpoint().getMskClient(), exchange); - break; - case createCluster: - createCluster(getEndpoint().getMskClient(), exchange); - break; - case deleteCluster: - deleteCluster(getEndpoint().getMskClient(), exchange); - break; - case describeCluster: - describeCluster(getEndpoint().getMskClient(), exchange); - break; - default: - throw new IllegalArgumentException("Unsupported operation"); - } - } - - private MSKOperations determineOperation(Exchange exchange) { - MSKOperations operation = exchange.getIn().getHeader(MSKConstants.OPERATION, MSKOperations.class); - if (operation == null) { - operation = getConfiguration().getOperation(); - } - return operation; - } - - protected MSKConfiguration getConfiguration() { - return getEndpoint().getConfiguration(); - } - - @Override - public String toString() { - if (mskProducerToString == null) { - mskProducerToString = "MSKProducer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]"; - } - return mskProducerToString; - } - - @Override - public MSKEndpoint getEndpoint() { - return (MSKEndpoint) super.getEndpoint(); - } - - private void listClusters(AWSKafka mskClient, Exchange exchange) { - ListClustersRequest request = new ListClustersRequest(); - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSKConstants.CLUSTERS_FILTER))) { - String filter = exchange.getIn().getHeader(MSKConstants.CLUSTERS_FILTER, String.class); - request.withClusterNameFilter(filter); - } - ListClustersResult result; - try { - result = mskClient.listClusters(request); - } catch (AmazonServiceException ase) { - LOG.trace("List Clusters command returned the error code {}", ase.getErrorCode()); - throw ase; - } - Message message = getMessageForResponse(exchange); - message.setBody(result); - } - - private void createCluster(AWSKafka mskClient, Exchange exchange) { - CreateClusterRequest request = new CreateClusterRequest(); - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSKConstants.CLUSTER_NAME))) { - String name = exchange.getIn().getHeader(MSKConstants.CLUSTER_NAME, String.class); - request.withClusterName(name); - } else { - throw new IllegalArgumentException("Cluster Name must be specified"); - } - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSKConstants.CLUSTER_KAFKA_VERSION))) { - String version = exchange.getIn().getHeader(MSKConstants.CLUSTER_KAFKA_VERSION, String.class); - request.withKafkaVersion(version); - } else { - throw new IllegalArgumentException("Kafka Version must be specified"); - } - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSKConstants.BROKER_NODES_NUMBER))) { - Integer nodesNumber = exchange.getIn().getHeader(MSKConstants.BROKER_NODES_NUMBER, Integer.class); - request.withNumberOfBrokerNodes(nodesNumber); - } else { - throw new IllegalArgumentException("Kafka Version must be specified"); - } - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSKConstants.BROKER_NODES_GROUP_INFO))) { - BrokerNodeGroupInfo brokerNodesGroupInfo - = exchange.getIn().getHeader(MSKConstants.BROKER_NODES_GROUP_INFO, BrokerNodeGroupInfo.class); - request.withBrokerNodeGroupInfo(brokerNodesGroupInfo); - } else { - throw new IllegalArgumentException("BrokerNodeGroupInfo must be specified"); - } - CreateClusterResult result; - try { - result = mskClient.createCluster(request); - } catch (AmazonServiceException ase) { - LOG.trace("Create Cluster command returned the error code {}", ase.getErrorCode()); - throw ase; - } - Message message = getMessageForResponse(exchange); - message.setBody(result); - } - - private void deleteCluster(AWSKafka mskClient, Exchange exchange) { - DeleteClusterRequest request = new DeleteClusterRequest(); - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSKConstants.CLUSTER_ARN))) { - String arn = exchange.getIn().getHeader(MSKConstants.CLUSTER_ARN, String.class); - request.withClusterArn(arn); - } else { - throw new IllegalArgumentException("Cluster ARN must be specified"); - } - DeleteClusterResult result; - try { - result = mskClient.deleteCluster(request); - } catch (AmazonServiceException ase) { - LOG.trace("Delete Cluster command returned the error code {}", ase.getErrorCode()); - throw ase; - } - Message message = getMessageForResponse(exchange); - message.setBody(result); - } - - private void describeCluster(AWSKafka mskClient, Exchange exchange) { - DescribeClusterRequest request = new DescribeClusterRequest(); - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(MSKConstants.CLUSTER_ARN))) { - String arn = exchange.getIn().getHeader(MSKConstants.CLUSTER_ARN, String.class); - request.withClusterArn(arn); - } else { - throw new IllegalArgumentException("Cluster ARN must be specified"); - } - DescribeClusterResult result; - try { - result = mskClient.describeCluster(request); - } catch (AmazonServiceException ase) { - LOG.trace("Delete Cluster command returned the error code {}", ase.getErrorCode()); - throw ase; - } - Message message = getMessageForResponse(exchange); - message.setBody(result); - } - - public static Message getMessageForResponse(final Exchange exchange) { - return exchange.getMessage(); - } -} diff --git a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/AmazonMSKClientMock.java b/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/AmazonMSKClientMock.java deleted file mode 100644 index 739df4a..0000000 --- a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/AmazonMSKClientMock.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import java.util.ArrayList; -import java.util.List; - -import com.amazonaws.services.kafka.AbstractAWSKafka; -import com.amazonaws.services.kafka.model.ClusterInfo; -import com.amazonaws.services.kafka.model.ClusterState; -import com.amazonaws.services.kafka.model.CreateClusterRequest; -import com.amazonaws.services.kafka.model.CreateClusterResult; -import com.amazonaws.services.kafka.model.DeleteClusterRequest; -import com.amazonaws.services.kafka.model.DeleteClusterResult; -import com.amazonaws.services.kafka.model.DescribeClusterRequest; -import com.amazonaws.services.kafka.model.DescribeClusterResult; -import com.amazonaws.services.kafka.model.ListClustersRequest; -import com.amazonaws.services.kafka.model.ListClustersResult; - -public class AmazonMSKClientMock extends AbstractAWSKafka { - - public AmazonMSKClientMock() { - } - - @Override - public ListClustersResult listClusters(ListClustersRequest request) { - ListClustersResult result = new ListClustersResult(); - List<ClusterInfo> info = new ArrayList<>(); - ClusterInfo info1 = new ClusterInfo(); - info1.setClusterName("test-kafka"); - info.add(info1); - result.setClusterInfoList(info); - return result; - } - - @Override - public CreateClusterResult createCluster(CreateClusterRequest request) { - CreateClusterResult result = new CreateClusterResult(); - result.setClusterName(request.getClusterName()); - result.setState(ClusterState.CREATING.name()); - return result; - } - - @Override - public DeleteClusterResult deleteCluster(DeleteClusterRequest request) { - DeleteClusterResult res = new DeleteClusterResult(); - res.setClusterArn(request.getClusterArn()); - res.setState(ClusterState.DELETING.name()); - return res; - } - - @Override - public DescribeClusterResult describeCluster(DescribeClusterRequest request) { - DescribeClusterResult res = new DescribeClusterResult(); - ClusterInfo clusterInfo = new ClusterInfo(); - clusterInfo.setClusterArn("test-kafka"); - clusterInfo.setState(ClusterState.ACTIVE.name()); - res.setClusterInfo(clusterInfo); - return res; - } -} diff --git a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentClientRegistryTest.java b/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentClientRegistryTest.java deleted file mode 100644 index c802235..0000000 --- a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentClientRegistryTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; - -public class MSKComponentClientRegistryTest extends CamelTestSupport { - - @Test - public void createEndpointWithMinimalMSKClientConfiguration() throws Exception { - - AmazonMSKClientMock awsMSKClient = new AmazonMSKClientMock(); - context.getRegistry().bind("awsMskClient", awsMSKClient); - MSKComponent component = context.getComponent("aws-msk", MSKComponent.class); - MSKEndpoint endpoint = (MSKEndpoint) component.createEndpoint("aws-msk://label"); - - assertNotNull(endpoint.getConfiguration().getMskClient()); - } - - @Test - public void createEndpointWithMinimalMSKClientMisconfiguration() throws Exception { - - MSKComponent component = context.getComponent("aws-msk", MSKComponent.class); - assertThrows(IllegalArgumentException.class, - () -> component.createEndpoint("aws-msk://label")); - } - - @Test - public void createEndpointWithAutoDiscoverClientFalse() throws Exception { - - AmazonMSKClientMock awsMSKClient = new AmazonMSKClientMock(); - context.getRegistry().bind("awsMskClient", awsMSKClient); - MSKComponent component = context.getComponent("aws-msk", MSKComponent.class); - MSKEndpoint endpoint = (MSKEndpoint) component - .createEndpoint("aws-msk://label?accessKey=xxx&secretKey=yyy&autoDiscoverClient=false"); - - assertNotSame(awsMSKClient, endpoint.getConfiguration().getMskClient()); - } - - @Test - public void createEndpointWithAutoDiscoverClientTrue() throws Exception { - - AmazonMSKClientMock awsMSKClient = new AmazonMSKClientMock(); - context.getRegistry().bind("awsMskClient", awsMSKClient); - MSKComponent component = context.getComponent("aws-msk", MSKComponent.class); - MSKEndpoint endpoint = (MSKEndpoint) component.createEndpoint("aws-msk://label?accessKey=xxx&secretKey=yyy"); - - assertSame(awsMSKClient, endpoint.getConfiguration().getMskClient()); - } -} diff --git a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentConfigurationTest.java b/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentConfigurationTest.java deleted file mode 100644 index 9862a6f..0000000 --- a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentConfigurationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import com.amazonaws.Protocol; -import com.amazonaws.regions.Regions; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MSKComponentConfigurationTest extends CamelTestSupport { - - @Test - public void createEndpointWithComponentElements() throws Exception { - MSKComponent component = context.getComponent("aws-msk", MSKComponent.class); - component.getConfiguration().setAccessKey("XXX"); - component.getConfiguration().setSecretKey("YYY"); - MSKEndpoint endpoint = (MSKEndpoint) component.createEndpoint("aws-msk://label"); - - assertEquals("XXX", endpoint.getConfiguration().getAccessKey()); - assertEquals("YYY", endpoint.getConfiguration().getSecretKey()); - } - - @Test - public void createEndpointWithComponentAndEndpointElements() throws Exception { - MSKComponent component = context.getComponent("aws-msk", MSKComponent.class); - component.getConfiguration().setAccessKey("XXX"); - component.getConfiguration().setSecretKey("YYY"); - component.getConfiguration().setRegion(Regions.US_WEST_1.toString()); - MSKEndpoint endpoint - = (MSKEndpoint) component.createEndpoint("aws-msk://label?accessKey=xxxxxx&secretKey=yyyyy®ion=US_EAST_1"); - - assertEquals("xxxxxx", endpoint.getConfiguration().getAccessKey()); - assertEquals("yyyyy", endpoint.getConfiguration().getSecretKey()); - assertEquals("US_EAST_1", endpoint.getConfiguration().getRegion()); - } - - @Test - public void createEndpointWithComponentEndpointElementsAndProxy() throws Exception { - MSKComponent component = context.getComponent("aws-msk", MSKComponent.class); - component.getConfiguration().setAccessKey("XXX"); - component.getConfiguration().setSecretKey("YYY"); - component.getConfiguration().setRegion(Regions.US_WEST_1.toString()); - MSKEndpoint endpoint = (MSKEndpoint) component.createEndpoint( - "aws-msk://label?accessKey=xxxxxx&secretKey=yyyyy®ion=US_EAST_1&proxyHost=localhost&proxyPort=9000&proxyProtocol=HTTP"); - - assertEquals("xxxxxx", endpoint.getConfiguration().getAccessKey()); - assertEquals("yyyyy", endpoint.getConfiguration().getSecretKey()); - assertEquals("US_EAST_1", endpoint.getConfiguration().getRegion()); - assertEquals(Protocol.HTTP, endpoint.getConfiguration().getProxyProtocol()); - assertEquals("localhost", endpoint.getConfiguration().getProxyHost()); - assertEquals(Integer.valueOf(9000), endpoint.getConfiguration().getProxyPort()); - } -} diff --git a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentVerifierExtensionTest.java b/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentVerifierExtensionTest.java deleted file mode 100644 index 1c0c3b0..0000000 --- a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKComponentVerifierExtensionTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.camel.Component; -import org.apache.camel.component.extension.ComponentVerifierExtension; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MSKComponentVerifierExtensionTest extends CamelTestSupport { - - // ************************************************* - // Tests (parameters) - // ************************************************* - @Override - public boolean isUseRouteBuilder() { - return false; - } - - @Test - public void testParameters() throws Exception { - Component component = context().getComponent("aws-msk"); - - ComponentVerifierExtension verifier - = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new); - - Map<String, Object> parameters = new HashMap<>(); - parameters.put("secretKey", "l"); - parameters.put("accessKey", "k"); - parameters.put("region", "l"); - parameters.put("label", "test"); - parameters.put("operation", MSKOperations.listClusters); - - ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); - } - - @Test - public void testConnectivity() throws Exception { - Component component = context().getComponent("aws-msk"); - ComponentVerifierExtension verifier - = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new); - - Map<String, Object> parameters = new HashMap<>(); - parameters.put("secretKey", "l"); - parameters.put("accessKey", "k"); - parameters.put("region", "US_EAST_1"); - parameters.put("label", "test"); - parameters.put("operation", MSKOperations.listClusters); - - ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - } - -} diff --git a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKProducerSpringTest.java b/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKProducerSpringTest.java deleted file mode 100644 index 37efbcf..0000000 --- a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKProducerSpringTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import com.amazonaws.services.kafka.model.BrokerNodeGroupInfo; -import com.amazonaws.services.kafka.model.ClusterState; -import com.amazonaws.services.kafka.model.CreateClusterResult; -import com.amazonaws.services.kafka.model.DeleteClusterResult; -import com.amazonaws.services.kafka.model.DescribeClusterResult; -import com.amazonaws.services.kafka.model.ListClustersResult; -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; -import org.junit.jupiter.api.Test; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MSKProducerSpringTest extends CamelSpringTestSupport { - - @EndpointInject("mock:result") - private MockEndpoint mock; - - @Test - public void mskListKeysTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:listClusters", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - } - }); - - assertMockEndpointsSatisfied(); - - ListClustersResult resultGet = (ListClustersResult) exchange.getIn().getBody(); - assertEquals(1, resultGet.getClusterInfoList().size()); - assertEquals("test-kafka", resultGet.getClusterInfoList().get(0).getClusterName()); - } - - @Test - public void mskCreateClusterTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:createCluster", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(MSKConstants.CLUSTER_NAME, "test-kafka"); - exchange.getIn().setHeader(MSKConstants.CLUSTER_KAFKA_VERSION, "2.1.1"); - exchange.getIn().setHeader(MSKConstants.BROKER_NODES_NUMBER, 2); - BrokerNodeGroupInfo groupInfo = new BrokerNodeGroupInfo(); - exchange.getIn().setHeader(MSKConstants.BROKER_NODES_GROUP_INFO, groupInfo); - } - }); - - assertMockEndpointsSatisfied(); - - CreateClusterResult resultGet = (CreateClusterResult) exchange.getIn().getBody(); - assertEquals("test-kafka", resultGet.getClusterName()); - assertEquals(ClusterState.CREATING.name(), resultGet.getState()); - } - - @Test - public void mskDeleteClusterTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:deleteCluster", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(MSKConstants.CLUSTER_ARN, "test-kafka"); - } - }); - - assertMockEndpointsSatisfied(); - - DeleteClusterResult resultGet = (DeleteClusterResult) exchange.getIn().getBody(); - assertEquals("test-kafka", resultGet.getClusterArn()); - assertEquals(ClusterState.DELETING.name(), resultGet.getState()); - } - - @Test - public void mskDescribeClusterTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:describeCluster", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(MSKConstants.CLUSTER_ARN, "test-kafka"); - } - }); - - assertMockEndpointsSatisfied(); - - DescribeClusterResult resultGet = (DescribeClusterResult) exchange.getIn().getBody(); - assertEquals("test-kafka", resultGet.getClusterInfo().getClusterArn()); - assertEquals(ClusterState.ACTIVE.name(), resultGet.getClusterInfo().getState()); - } - - @Override - protected ClassPathXmlApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("org/apache/camel/component/aws/msk/MSKComponentSpringTest-context.xml"); - } -} diff --git a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKProducerTest.java b/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKProducerTest.java deleted file mode 100644 index 40c8e1b..0000000 --- a/components/camel-aws-msk/src/test/java/org/apache/camel/component/aws/msk/MSKProducerTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.component.aws.msk; - -import com.amazonaws.services.kafka.model.BrokerNodeGroupInfo; -import com.amazonaws.services.kafka.model.ClusterState; -import com.amazonaws.services.kafka.model.CreateClusterResult; -import com.amazonaws.services.kafka.model.DeleteClusterResult; -import com.amazonaws.services.kafka.model.DescribeClusterResult; -import com.amazonaws.services.kafka.model.ListClustersResult; -import org.apache.camel.BindToRegistry; -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MSKProducerTest extends CamelTestSupport { - - @BindToRegistry("amazonMskClient") - AmazonMSKClientMock clientMock = new AmazonMSKClientMock(); - - @EndpointInject("mock:result") - private MockEndpoint mock; - - @Test - public void mskListClustersTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:listClusters", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - } - }); - - assertMockEndpointsSatisfied(); - - ListClustersResult resultGet = (ListClustersResult) exchange.getIn().getBody(); - assertEquals(1, resultGet.getClusterInfoList().size()); - assertEquals("test-kafka", resultGet.getClusterInfoList().get(0).getClusterName()); - } - - @Test - public void mskCreateClusterTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:createCluster", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(MSKConstants.CLUSTER_NAME, "test-kafka"); - exchange.getIn().setHeader(MSKConstants.CLUSTER_KAFKA_VERSION, "2.1.1"); - exchange.getIn().setHeader(MSKConstants.BROKER_NODES_NUMBER, 2); - BrokerNodeGroupInfo groupInfo = new BrokerNodeGroupInfo(); - exchange.getIn().setHeader(MSKConstants.BROKER_NODES_GROUP_INFO, groupInfo); - } - }); - - assertMockEndpointsSatisfied(); - - CreateClusterResult resultGet = (CreateClusterResult) exchange.getIn().getBody(); - assertEquals("test-kafka", resultGet.getClusterName()); - assertEquals(ClusterState.CREATING.name(), resultGet.getState()); - } - - @Test - public void mskDeleteClusterTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:deleteCluster", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(MSKConstants.CLUSTER_ARN, "test-kafka"); - } - }); - - assertMockEndpointsSatisfied(); - - DeleteClusterResult resultGet = (DeleteClusterResult) exchange.getIn().getBody(); - assertEquals("test-kafka", resultGet.getClusterArn()); - assertEquals(ClusterState.DELETING.name(), resultGet.getState()); - } - - @Test - public void mskDescribeClusterTest() throws Exception { - - mock.expectedMessageCount(1); - Exchange exchange = template.request("direct:describeCluster", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(MSKConstants.CLUSTER_ARN, "test-kafka"); - } - }); - - assertMockEndpointsSatisfied(); - - DescribeClusterResult resultGet = (DescribeClusterResult) exchange.getIn().getBody(); - assertEquals("test-kafka", resultGet.getClusterInfo().getClusterArn()); - assertEquals(ClusterState.ACTIVE.name(), resultGet.getClusterInfo().getState()); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:listClusters").to("aws-msk://test?mskClient=#amazonMskClient&operation=listClusters") - .to("mock:result"); - from("direct:createCluster").to("aws-msk://test?mskClient=#amazonMskClient&operation=createCluster") - .to("mock:result"); - from("direct:deleteCluster").to("aws-msk://test?mskClient=#amazonMskClient&operation=deleteCluster") - .to("mock:result"); - from("direct:describeCluster").to("aws-msk://test?mskClient=#amazonMskClient&operation=describeCluster") - .to("mock:result"); - } - }; - } -} diff --git a/components/camel-aws-msk/src/test/resources/log4j2.properties b/components/camel-aws-msk/src/test/resources/log4j2.properties deleted file mode 100644 index 986f470..0000000 --- a/components/camel-aws-msk/src/test/resources/log4j2.properties +++ /dev/null @@ -1,28 +0,0 @@ -## --------------------------------------------------------------------------- -## 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 -## -## 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. -## --------------------------------------------------------------------------- - -appender.file.type = File -appender.file.name = file -appender.file.fileName = target/camel-aws-kms-test.log -appender.file.layout.type = PatternLayout -appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n -appender.out.type = Console -appender.out.name = out -appender.out.layout.type = PatternLayout -appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n -rootLogger.level = INFO -rootLogger.appenderRef.file.ref = file diff --git a/components/camel-aws-msk/src/test/resources/org/apache/camel/component/aws/msk/MSKComponentSpringTest-context.xml b/components/camel-aws-msk/src/test/resources/org/apache/camel/component/aws/msk/MSKComponentSpringTest-context.xml deleted file mode 100644 index f6f8baf..0000000 --- a/components/camel-aws-msk/src/test/resources/org/apache/camel/component/aws/msk/MSKComponentSpringTest-context.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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 - - 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. - ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:listClusters"/> - <to uri="aws-msk://Test?mskClient=#amazonMskClient&operation=listClusters"/> - <to uri="mock:result"/> - </route> - - <route> - <from uri="direct:createCluster"/> - <to uri="aws-msk://Test?mskClient=#amazonMskClient&operation=createCluster"/> - <to uri="mock:result"/> - </route> - - <route> - <from uri="direct:deleteCluster"/> - <to uri="aws-msk://Test?mskClient=#amazonMskClient&operation=deleteCluster"/> - <to uri="mock:result"/> - </route> - - <route> - <from uri="direct:describeCluster"/> - <to uri="aws-msk://Test?mskClient=#amazonMskClient&operation=describeCluster"/> - <to uri="mock:result"/> - </route> - </camelContext> - - <bean id="amazonMskClient" class="org.apache.camel.component.aws.msk.AmazonMSKClientMock"/> -</beans> \ No newline at end of file diff --git a/components/pom.xml b/components/pom.xml index 563382d..9546aeb 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -117,7 +117,6 @@ <module>camel-aws-kms</module> <module>camel-aws-lambda</module> <module>camel-aws-mq</module> - <module>camel-aws-msk</module> <module>camel-aws-s3</module> <module>camel-aws-swf</module> <module>camel-aws2-athena</module> diff --git a/core/camel-allcomponents/pom.xml b/core/camel-allcomponents/pom.xml index 01991ef..3696983 100644 --- a/core/camel-allcomponents/pom.xml +++ b/core/camel-allcomponents/pom.xml @@ -151,10 +151,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-aws-msk</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-aws-s3</artifactId> </dependency> <dependency> diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index c3139c6..552bd6d 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -474,20 +474,6 @@ public interface ComponentsBuilderFactory { return org.apache.camel.builder.component.dsl.AwsMqComponentBuilderFactory.awsMq(); } /** - * AWS Managed Streaming for Apache Kafka (MSK) (camel-aws-msk) - * Manage AWS MSK instances. - * - * Category: cloud,messaging - * Since: 3.0 - * Maven coordinates: org.apache.camel:camel-aws-msk - * - * @return the dsl builder - */ - @Deprecated - static org.apache.camel.builder.component.dsl.AwsMskComponentBuilderFactory.AwsMskComponentBuilder awsMsk() { - return org.apache.camel.builder.component.dsl.AwsMskComponentBuilderFactory.awsMsk(); - } - /** * AWS S3 Storage Service (camel-aws-s3) * Store and retrieve objects from AWS S3 Storage Service. * @@ -4876,4 +4862,4 @@ public interface ComponentsBuilderFactory { static org.apache.camel.builder.component.dsl.ZookeeperMasterComponentBuilderFactory.ZookeeperMasterComponentBuilder zookeeperMaster() { return org.apache.camel.builder.component.dsl.ZookeeperMasterComponentBuilderFactory.zookeeperMaster(); } -} \ No newline at end of file +} diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsMskComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsMskComponentBuilderFactory.java deleted file mode 100644 index 7faecc7..0000000 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsMskComponentBuilderFactory.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.builder.component.dsl; - -import javax.annotation.Generated; -import org.apache.camel.Component; -import org.apache.camel.builder.component.AbstractComponentBuilder; -import org.apache.camel.builder.component.ComponentBuilder; -import org.apache.camel.component.aws.msk.MSKComponent; - -/** - * Manage AWS MSK instances. - * - * Generated by camel-package-maven-plugin - do not edit this file! - */ -@Generated("org.apache.camel.maven.packaging.ComponentDslMojo") -public interface AwsMskComponentBuilderFactory { - - /** - * AWS Managed Streaming for Apache Kafka (MSK) (camel-aws-msk) - * Manage AWS MSK instances. - * - * Category: cloud,messaging - * Since: 3.0 - * Maven coordinates: org.apache.camel:camel-aws-msk - * - * @return the dsl builder - */ - @Deprecated - static AwsMskComponentBuilder awsMsk() { - return new AwsMskComponentBuilderImpl(); - } - - /** - * Builder for the AWS Managed Streaming for Apache Kafka (MSK) component. - */ - interface AwsMskComponentBuilder extends ComponentBuilder<MSKComponent> { - /** - * Setting the autoDiscoverClient mechanism, if true, the component will - * look for a client instance in the registry automatically otherwise it - * will skip that checking. - * - * The option is a: <code>boolean</code> type. - * - * Default: true - * Group: common - * - * @param autoDiscoverClient the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder autoDiscoverClient( - boolean autoDiscoverClient) { - doSetProperty("autoDiscoverClient", autoDiscoverClient); - return this; - } - /** - * Amazon AWS Access Key. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param accessKey the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder accessKey(java.lang.String accessKey) { - doSetProperty("accessKey", accessKey); - return this; - } - /** - * The component configuration. - * - * The option is a: - * <code>org.apache.camel.component.aws.msk.MSKConfiguration</code> type. - * - * Group: producer - * - * @param configuration the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder configuration( - org.apache.camel.component.aws.msk.MSKConfiguration configuration) { - doSetProperty("configuration", configuration); - return this; - } - /** - * Whether the producer should be started lazy (on the first message). - * By starting lazy you can use this to allow CamelContext and routes to - * startup in situations where a producer may otherwise fail during - * starting and cause the route to fail being started. By deferring this - * startup to be lazy then the startup failure can be handled during - * routing messages via Camel's routing error handlers. Beware that when - * the first message is processed then creating and starting the - * producer may take a little time and prolong the total processing time - * of the processing. - * - * The option is a: <code>boolean</code> type. - * - * Default: false - * Group: producer - * - * @param lazyStartProducer the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder lazyStartProducer( - boolean lazyStartProducer) { - doSetProperty("lazyStartProducer", lazyStartProducer); - return this; - } - /** - * To use a existing configured AWS MSK as client. - * - * The option is a: - * <code>com.amazonaws.services.kafka.AWSKafka</code> type. - * - * Group: producer - * - * @param mskClient the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder mskClient( - com.amazonaws.services.kafka.AWSKafka mskClient) { - doSetProperty("mskClient", mskClient); - return this; - } - /** - * The operation to perform. - * - * The option is a: - * <code>org.apache.camel.component.aws.msk.MSKOperations</code> type. - * - * Group: producer - * - * @param operation the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder operation( - org.apache.camel.component.aws.msk.MSKOperations operation) { - doSetProperty("operation", operation); - return this; - } - /** - * To define a proxy host when instantiating the MSK client. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param proxyHost the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder proxyHost(java.lang.String proxyHost) { - doSetProperty("proxyHost", proxyHost); - return this; - } - /** - * To define a proxy port when instantiating the MSK client. - * - * The option is a: <code>java.lang.Integer</code> type. - * - * Group: producer - * - * @param proxyPort the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder proxyPort(java.lang.Integer proxyPort) { - doSetProperty("proxyPort", proxyPort); - return this; - } - /** - * To define a proxy protocol when instantiating the MSK client. - * - * The option is a: <code>com.amazonaws.Protocol</code> - * type. - * - * Default: HTTPS - * Group: producer - * - * @param proxyProtocol the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder proxyProtocol( - com.amazonaws.Protocol proxyProtocol) { - doSetProperty("proxyProtocol", proxyProtocol); - return this; - } - /** - * The region in which MSK client needs to work. When using this - * parameter, the configuration will expect the capitalized name of the - * region (for example AP_EAST_1) You'll need to use the name - * Regions.EU_WEST_1.name(). - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param region the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder region(java.lang.String region) { - doSetProperty("region", region); - return this; - } - /** - * Amazon AWS Secret Key. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param secretKey the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder secretKey(java.lang.String secretKey) { - doSetProperty("secretKey", secretKey); - return this; - } - /** - * Whether autowiring is enabled. This is used for automatic autowiring - * options (the option must be marked as autowired) by looking up in the - * registry to find if there is a single instance of matching type, - * which then gets configured on the component. This can be used for - * automatic configuring JDBC data sources, JMS connection factories, - * AWS Clients, etc. - * - * The option is a: <code>boolean</code> type. - * - * Default: true - * Group: advanced - * - * @param autowiredEnabled the value to set - * @return the dsl builder - */ - default AwsMskComponentBuilder autowiredEnabled(boolean autowiredEnabled) { - doSetProperty("autowiredEnabled", autowiredEnabled); - return this; - } - } - - class AwsMskComponentBuilderImpl - extends - AbstractComponentBuilder<MSKComponent> - implements - AwsMskComponentBuilder { - @Override - protected MSKComponent buildConcreteComponent() { - return new MSKComponent(); - } - private org.apache.camel.component.aws.msk.MSKConfiguration getOrCreateConfiguration( - org.apache.camel.component.aws.msk.MSKComponent component) { - if (component.getConfiguration() == null) { - component.setConfiguration(new org.apache.camel.component.aws.msk.MSKConfiguration()); - } - return component.getConfiguration(); - } - @Override - protected boolean setPropertyOnComponent( - Component component, - String name, - Object value) { - switch (name) { - case "autoDiscoverClient": getOrCreateConfiguration((MSKComponent) component).setAutoDiscoverClient((boolean) value); return true; - case "accessKey": getOrCreateConfiguration((MSKComponent) component).setAccessKey((java.lang.String) value); return true; - case "configuration": ((MSKComponent) component).setConfiguration((org.apache.camel.component.aws.msk.MSKConfiguration) value); return true; - case "lazyStartProducer": ((MSKComponent) component).setLazyStartProducer((boolean) value); return true; - case "mskClient": getOrCreateConfiguration((MSKComponent) component).setMskClient((com.amazonaws.services.kafka.AWSKafka) value); return true; - case "operation": getOrCreateConfiguration((MSKComponent) component).setOperation((org.apache.camel.component.aws.msk.MSKOperations) value); return true; - case "proxyHost": getOrCreateConfiguration((MSKComponent) component).setProxyHost((java.lang.String) value); return true; - case "proxyPort": getOrCreateConfiguration((MSKComponent) component).setProxyPort((java.lang.Integer) value); return true; - case "proxyProtocol": getOrCreateConfiguration((MSKComponent) component).setProxyProtocol((com.amazonaws.Protocol) value); return true; - case "region": getOrCreateConfiguration((MSKComponent) component).setRegion((java.lang.String) value); return true; - case "secretKey": getOrCreateConfiguration((MSKComponent) component).setSecretKey((java.lang.String) value); return true; - case "autowiredEnabled": ((MSKComponent) component).setAutowiredEnabled((boolean) value); return true; - default: return false; - } - } - } -} \ No newline at end of file diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index 58c6232..d5fe8fa 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -2372,51 +2372,6 @@ public class StaticEndpointBuilders { return org.apache.camel.builder.endpoint.dsl.MQEndpointBuilderFactory.endpointBuilder(componentName, path); } /** - * AWS Managed Streaming for Apache Kafka (MSK) (camel-aws-msk) - * Manage AWS MSK instances. - * - * Category: cloud,messaging - * Since: 3.0 - * Maven coordinates: org.apache.camel:camel-aws-msk - * - * Syntax: <code>aws-msk:label</code> - * - * Path parameter: label (required) - * Logical name - * - * @param path label - * @return the dsl builder - */ - @Deprecated - public static org.apache.camel.builder.endpoint.dsl.MSKEndpointBuilderFactory.MSKEndpointBuilder awsMsk( - String path) { - return org.apache.camel.builder.endpoint.dsl.MSKEndpointBuilderFactory.endpointBuilder("aws-msk", path); - } - /** - * AWS Managed Streaming for Apache Kafka (MSK) (camel-aws-msk) - * Manage AWS MSK instances. - * - * Category: cloud,messaging - * Since: 3.0 - * Maven coordinates: org.apache.camel:camel-aws-msk - * - * Syntax: <code>aws-msk:label</code> - * - * Path parameter: label (required) - * Logical name - * - * @param componentName to use a custom component name for the endpoint - * instead of the default name - * @param path label - * @return the dsl builder - */ - @Deprecated - public static org.apache.camel.builder.endpoint.dsl.MSKEndpointBuilderFactory.MSKEndpointBuilder awsMsk( - String componentName, - String path) { - return org.apache.camel.builder.endpoint.dsl.MSKEndpointBuilderFactory.endpointBuilder(componentName, path); - } - /** * AWS S3 Storage Service (camel-aws-s3) * Store and retrieve objects from AWS S3 Storage Service. * @@ -17072,4 +17027,4 @@ public class StaticEndpointBuilders { return org.apache.camel.builder.endpoint.dsl.ZooKeeperMasterEndpointBuilderFactory.endpointBuilder(componentName, path); } } -//CHECKSTYLE:ON \ No newline at end of file +//CHECKSTYLE:ON diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MSKEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MSKEndpointBuilderFactory.java deleted file mode 100644 index 4dee586..0000000 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MSKEndpointBuilderFactory.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * 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 - * - * 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. - */ -package org.apache.camel.builder.endpoint.dsl; - -import javax.annotation.Generated; -import org.apache.camel.builder.EndpointConsumerBuilder; -import org.apache.camel.builder.EndpointProducerBuilder; -import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; - -/** - * Manage AWS MSK instances. - * - * Generated by camel build tools - do NOT edit this file! - */ -@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") -public interface MSKEndpointBuilderFactory { - - - /** - * Builder for endpoint for the AWS Managed Streaming for Apache Kafka (MSK) - * component. - */ - public interface MSKEndpointBuilder extends EndpointProducerBuilder { - /** - * Setting the autoDiscoverClient mechanism, if true, the component will - * look for a client instance in the registry automatically otherwise it - * will skip that checking. - * - * The option is a: <code>boolean</code> type. - * - * Default: true - * Group: common - * - * @param autoDiscoverClient the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder autoDiscoverClient(boolean autoDiscoverClient) { - doSetProperty("autoDiscoverClient", autoDiscoverClient); - return this; - } - /** - * Setting the autoDiscoverClient mechanism, if true, the component will - * look for a client instance in the registry automatically otherwise it - * will skip that checking. - * - * The option will be converted to a <code>boolean</code> - * type. - * - * Default: true - * Group: common - * - * @param autoDiscoverClient the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder autoDiscoverClient(String autoDiscoverClient) { - doSetProperty("autoDiscoverClient", autoDiscoverClient); - return this; - } - /** - * Amazon AWS Access Key. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param accessKey the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder accessKey(String accessKey) { - doSetProperty("accessKey", accessKey); - return this; - } - /** - * Whether the producer should be started lazy (on the first message). - * By starting lazy you can use this to allow CamelContext and routes to - * startup in situations where a producer may otherwise fail during - * starting and cause the route to fail being started. By deferring this - * startup to be lazy then the startup failure can be handled during - * routing messages via Camel's routing error handlers. Beware that when - * the first message is processed then creating and starting the - * producer may take a little time and prolong the total processing time - * of the processing. - * - * The option is a: <code>boolean</code> type. - * - * Default: false - * Group: producer - * - * @param lazyStartProducer the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder lazyStartProducer(boolean lazyStartProducer) { - doSetProperty("lazyStartProducer", lazyStartProducer); - return this; - } - /** - * Whether the producer should be started lazy (on the first message). - * By starting lazy you can use this to allow CamelContext and routes to - * startup in situations where a producer may otherwise fail during - * starting and cause the route to fail being started. By deferring this - * startup to be lazy then the startup failure can be handled during - * routing messages via Camel's routing error handlers. Beware that when - * the first message is processed then creating and starting the - * producer may take a little time and prolong the total processing time - * of the processing. - * - * The option will be converted to a <code>boolean</code> - * type. - * - * Default: false - * Group: producer - * - * @param lazyStartProducer the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder lazyStartProducer(String lazyStartProducer) { - doSetProperty("lazyStartProducer", lazyStartProducer); - return this; - } - /** - * To use a existing configured AWS MSK as client. - * - * The option is a: - * <code>com.amazonaws.services.kafka.AWSKafka</code> type. - * - * Group: producer - * - * @param mskClient the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder mskClient(Object mskClient) { - doSetProperty("mskClient", mskClient); - return this; - } - /** - * To use a existing configured AWS MSK as client. - * - * The option will be converted to a - * <code>com.amazonaws.services.kafka.AWSKafka</code> type. - * - * Group: producer - * - * @param mskClient the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder mskClient(String mskClient) { - doSetProperty("mskClient", mskClient); - return this; - } - /** - * The operation to perform. - * - * The option is a: - * <code>org.apache.camel.component.aws.msk.MSKOperations</code> type. - * - * Required: true - * Group: producer - * - * @param operation the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder operation(MSKOperations operation) { - doSetProperty("operation", operation); - return this; - } - /** - * The operation to perform. - * - * The option will be converted to a - * <code>org.apache.camel.component.aws.msk.MSKOperations</code> type. - * - * Required: true - * Group: producer - * - * @param operation the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder operation(String operation) { - doSetProperty("operation", operation); - return this; - } - /** - * To define a proxy host when instantiating the MSK client. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param proxyHost the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder proxyHost(String proxyHost) { - doSetProperty("proxyHost", proxyHost); - return this; - } - /** - * To define a proxy port when instantiating the MSK client. - * - * The option is a: <code>java.lang.Integer</code> type. - * - * Group: producer - * - * @param proxyPort the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder proxyPort(Integer proxyPort) { - doSetProperty("proxyPort", proxyPort); - return this; - } - /** - * To define a proxy port when instantiating the MSK client. - * - * The option will be converted to a - * <code>java.lang.Integer</code> type. - * - * Group: producer - * - * @param proxyPort the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder proxyPort(String proxyPort) { - doSetProperty("proxyPort", proxyPort); - return this; - } - /** - * To define a proxy protocol when instantiating the MSK client. - * - * The option is a: <code>com.amazonaws.Protocol</code> - * type. - * - * Default: HTTPS - * Group: producer - * - * @param proxyProtocol the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder proxyProtocol(Protocol proxyProtocol) { - doSetProperty("proxyProtocol", proxyProtocol); - return this; - } - /** - * To define a proxy protocol when instantiating the MSK client. - * - * The option will be converted to a - * <code>com.amazonaws.Protocol</code> type. - * - * Default: HTTPS - * Group: producer - * - * @param proxyProtocol the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder proxyProtocol(String proxyProtocol) { - doSetProperty("proxyProtocol", proxyProtocol); - return this; - } - /** - * The region in which MSK client needs to work. When using this - * parameter, the configuration will expect the capitalized name of the - * region (for example AP_EAST_1) You'll need to use the name - * Regions.EU_WEST_1.name(). - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param region the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder region(String region) { - doSetProperty("region", region); - return this; - } - /** - * Amazon AWS Secret Key. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: producer - * - * @param secretKey the value to set - * @return the dsl builder - */ - default MSKEndpointBuilder secretKey(String secretKey) { - doSetProperty("secretKey", secretKey); - return this; - } - } - - /** - * Proxy enum for - * <code>org.apache.camel.component.aws.msk.MSKOperations</code> enum. - */ - enum MSKOperations { - listClusters, - createCluster, - deleteCluster, - describeCluster; - } - - /** - * Proxy enum for <code>com.amazonaws.Protocol</code> enum. - */ - enum Protocol { - HTTP, - HTTPS; - } - - public interface MSKBuilders { - /** - * AWS Managed Streaming for Apache Kafka (MSK) (camel-aws-msk) - * Manage AWS MSK instances. - * - * Category: cloud,messaging - * Since: 3.0 - * Maven coordinates: org.apache.camel:camel-aws-msk - * - * Syntax: <code>aws-msk:label</code> - * - * Path parameter: label (required) - * Logical name - * - * @param path label - * @return the dsl builder - */ - @Deprecated - default MSKEndpointBuilder awsMsk(String path) { - return MSKEndpointBuilderFactory.endpointBuilder("aws-msk", path); - } - /** - * AWS Managed Streaming for Apache Kafka (MSK) (camel-aws-msk) - * Manage AWS MSK instances. - * - * Category: cloud,messaging - * Since: 3.0 - * Maven coordinates: org.apache.camel:camel-aws-msk - * - * Syntax: <code>aws-msk:label</code> - * - * Path parameter: label (required) - * Logical name - * - * @param componentName to use a custom component name for the endpoint - * instead of the default name - * @param path label - * @return the dsl builder - */ - @Deprecated - default MSKEndpointBuilder awsMsk(String componentName, String path) { - return MSKEndpointBuilderFactory.endpointBuilder(componentName, path); - } - } - @Deprecated - static MSKEndpointBuilder endpointBuilder(String componentName, String path) { - class MSKEndpointBuilderImpl extends AbstractEndpointBuilder implements MSKEndpointBuilder { - public MSKEndpointBuilderImpl(String path) { - super(componentName, path); - } - } - return new MSKEndpointBuilderImpl(path); - } -} \ No newline at end of file diff --git a/parent/pom.xml b/parent/pom.xml index 10ae1de..b70b44f 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -909,11 +909,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-aws-msk</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-aws-s3</artifactId> <version>${project.version}</version> </dependency>