├── .gitignore ├── Jenkinsfile ├── LICENSE ├── README.md ├── pom.xml ├── src └── main │ └── resources │ ├── META-INF │ └── maven │ │ └── archetype.xml │ └── archetype-resources │ ├── README.md │ ├── bin │ └── debug.sh │ ├── config │ ├── MySinkConnector.properties │ ├── MySourceConnector.properties │ └── connect-avro-docker.properties │ ├── docker-compose.yml │ ├── pom.xml │ └── src │ ├── main │ ├── assembly │ │ └── package.xml │ └── java │ │ ├── MyConverter.java │ │ ├── MyKeyValueTransformation.java │ │ ├── MyKeyValueTransformationConfig.java │ │ ├── MySinkConnector.java │ │ ├── MySinkConnectorConfig.java │ │ ├── MySinkTask.java │ │ ├── MySourceConnector.java │ │ ├── MySourceConnectorConfig.java │ │ ├── MySourceTask.java │ │ └── package-info.java │ └── test │ ├── java │ ├── DocumentationTest.java │ ├── MyConverterTest.java │ ├── MyKeyValueTransformationTest.java │ ├── MySinkConnectorTest.java │ ├── MySinkTaskIT.java │ ├── MySinkTaskTest.java │ ├── MySourceConnectorTest.java │ ├── MySourceTaskIT.java │ └── MySourceTaskTest.java │ └── resources │ └── logback.xml └── test-archtype.sh /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | #!groovy 2 | @Library('jenkins-pipeline') import com.github.jcustenborder.jenkins.pipeline.MavenCentralPipeline 3 | 4 | def pipe = new MavenCentralPipeline() 5 | pipe.execute() -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Maven Central](https://img.shields.io/maven-central/v/com.github.jcustenborder.kafka.connect/kafka-connect-quickstart.svg) 2 | 3 | This maven quickstart is used to generate a skeleton plugin for Kafka Connect. Look 4 | [here](https://search.maven.org/search?q=g:com.github.jcustenborder.kafka.connect%20AND%20a:kafka-connect-quickstart&core=gav) 5 | for a list of available versions. 6 | 7 | 8 | ``` 9 | mvn archetype:generate \ 10 | -DarchetypeGroupId=com.github.jcustenborder.kafka.connect \ 11 | -DarchetypeArtifactId=kafka-connect-quickstart \ 12 | -DarchetypeVersion=2.4.0 13 | ``` 14 | 15 | ``` 16 | mvn archetype:generate \ 17 | -DarchetypeGroupId=com.github.jcustenborder.kafka.connect \ 18 | -DarchetypeArtifactId=kafka-connect-quickstart \ 19 | -DarchetypeVersion=2.4.0 \ 20 | -Dpackage=com.github.jcustenborder.kafka.connect.test \ 21 | -DgroupId=com.github.jcustenborder.kafka.connect \ 22 | -DartifactId=testconnect \ 23 | -DpackageName=com.github.jcustenborder.kafka.connect.test \ 24 | -Dversion=1.0-SNAPSHOT 25 | ``` 26 | 27 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.github.jcustenborder 9 | maven-central-parent 10 | 1.0.0.0 11 | 12 | 13 | com.github.jcustenborder.kafka.connect 14 | kafka-connect-quickstart 15 | 2.4.0 16 | kafka-connect-archtype 17 | A quickstart for building Kafka Connect connectors. 18 | https://github.com/jcustenborder/kafka-connect-archtype 19 | 2017 20 | 21 | 22 | The Apache License, Version 2.0 23 | https://www.apache.org/licenses/LICENSE-2.0 24 | repo 25 | 26 | 27 | 28 | 29 | jcustenborder 30 | Jeremy Custenborder 31 | jcustenborder@gmail.com 32 | America/Chicago 33 | 34 | 35 | 36 | scm:git:https://github.com/jcustenborder/kafka-connect-archtype.git 37 | scm:git:git@github.com:jcustenborder/kafka-connect-archtype.git 38 | https://github.com/jcustenborder/kafka-connect-archtype 39 | 40 | 41 | github 42 | https://github.com/jcustenborder/kafka-connect-archtype/issues 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/maven/archetype.xml: -------------------------------------------------------------------------------- 1 | 4 | quickstart 5 | 6 | src/main/java/package-info.java 7 | src/main/java/MyConverter.java 8 | src/main/java/MyKeyValueTransformation.java 9 | src/main/java/MyKeyValueTransformationConfig.java 10 | src/main/java/MySourceConnector.java 11 | src/main/java/MySourceConnectorConfig.java 12 | src/main/java/MySourceTask.java 13 | src/main/java/MySinkTask.java 14 | src/main/java/MySinkConnector.java 15 | src/main/java/MySinkConnectorConfig.java 16 | 17 | 18 | src/main/assembly/package.xml 19 | config/connect-avro-docker.properties 20 | config/MySinkConnector.properties 21 | config/MySourceConnector.properties 22 | README.md 23 | docker-compose.yml 24 | bin/debug.sh 25 | src/test/resources/logback.xml 26 | 27 | 28 | src/test/java/MyConverterTest.java 29 | src/test/java/MyKeyValueTransformationTest.java 30 | src/test/java/MySinkConnectorTest.java 31 | src/test/java/MySinkTaskTest.java 32 | src/test/java/MySinkTaskIT.java 33 | src/test/java/MySourceConnectorTest.java 34 | src/test/java/MySourceTaskTest.java 35 | src/test/java/MySourceTaskIT.java 36 | src/test/java/DocumentationTest.java 37 | 38 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Welcome to your new Kafka Connect plugin! 4 | 5 | # Running in development 6 | 7 | ## Configuring Docker 8 | 9 | The [docker-compose.yml](docker-compose.yml) that is included in this repository is based on the Confluent Platform Docker 10 | images. Take a look at the [quickstart](http://docs.confluent.io/current/cp-docker-images/docs/quickstart.html#getting-started-with-docker-client) 11 | for the Docker images. 12 | 13 | Your development workstation needs to be able to resolve the hostnames that are listed in the `docker-compose.yml` 14 | file in the root of this repository. If you are using [Docker for Mac](https://docs.docker.com/v17.12/docker-for-mac/install/) 15 | your containers will be available at the ip address `127.0.0.1`. If you are running docker-machine 16 | you will need to determine the ip address of the virtual machine with `docker-machine ip confluent` 17 | to determine the ip address. 18 | 19 | ``` 20 | 127.0.0.1 zookeeper 21 | 127.0.0.1 kafka 22 | 127.0.0.1 schema-registry 23 | ``` 24 | 25 | ## Start Docker 26 | 27 | ``` 28 | docker-compose up -d 29 | ``` 30 | 31 | ## Starting your connector 32 | 33 | The debug script assumes that `connect-standalone` is in the path on your local workstation. Download 34 | the latest version of the [Kafka](https://www.confluent.io/download/) to get started. 35 | 36 | 37 | Start the connector with debugging enabled. 38 | 39 | ``` 40 | ./bin/debug.sh 41 | ``` 42 | 43 | Start the connector with debugging enabled. This will wait for a debugger to attach. 44 | 45 | ``` 46 | export SUSPEND='y' 47 | ./bin/debug.sh 48 | ``` -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/bin/debug.sh: -------------------------------------------------------------------------------- 1 | #[[ 2 | #!/usr/bin/env bash 3 | 4 | : ${SUSPEND:='n'} 5 | 6 | set -e 7 | 8 | mvn clean package 9 | export KAFKA_JMX_OPTS="-Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=${SUSPEND},address=5005" 10 | 11 | connect-standalone config/connect-avro-docker.properties config/MySinkConnector.properties config/MySourceConnector.properties 12 | ]]# -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/config/MySinkConnector.properties: -------------------------------------------------------------------------------- 1 | name=MySinkConnector 2 | topics=mytopic 3 | tasks.max=1 4 | connector.class=${package}.MySinkConnector 5 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/config/MySourceConnector.properties: -------------------------------------------------------------------------------- 1 | name=MySourceConnector 2 | tasks.max=1 3 | connector.class=${package}.MySourceConnector -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/config/connect-avro-docker.properties: -------------------------------------------------------------------------------- 1 | # Sample configuration for a standalone Kafka Connect worker that uses Avro serialization and 2 | # integrates the the SchemaConfig Registry. This sample configuration assumes a local installation of 3 | # Confluent Platform with all services running on their default ports. 4 | # Bootstrap Kafka servers. If multiple servers are specified, they should be comma-separated. 5 | bootstrap.servers=confluent:9092 6 | # The converters specify the format of data in Kafka and how to translate it into Connect data. 7 | # Every Connect user will need to configure these based on the format they want their data in 8 | # when loaded from or stored into Kafka 9 | key.converter=io.confluent.connect.avro.AvroConverter 10 | key.converter.schema.registry.url=http://confluent:8081 11 | value.converter=io.confluent.connect.avro.AvroConverter 12 | value.converter.schema.registry.url=http://confluent:8081 13 | # The internal converter used for offsets and config data is configurable and must be specified, 14 | # but most users will always want to use the built-in default. Offset and config data is never 15 | # visible outside of Connect in this format. 16 | internal.key.converter=org.apache.kafka.connect.json.JsonConverter 17 | internal.value.converter=org.apache.kafka.connect.json.JsonConverter 18 | internal.key.converter.schemas.enable=false 19 | internal.value.converter.schemas.enable=false 20 | # Local storage file for offset data 21 | offset.storage.file.filename=/tmp/connect.offsets 22 | 23 | # Confuent Control Center Integration -- uncomment these lines to enable Kafka client interceptors 24 | # that will report audit data that can be displayed and analyzed in Confluent Control Center 25 | # producer.interceptor.classes=io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor 26 | # consumer.interceptor.classes=io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor 27 | 28 | # Load our plugin from the output path. 29 | plugin.path=target/kafka-connect-target -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright © 2017 Jeremy Custenborder (jcustenborder@gmail.com) 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | version: "2" 18 | services: 19 | zookeeper: 20 | image: confluentinc/cp-zookeeper:5.4.0 21 | environment: 22 | ZOOKEEPER_CLIENT_PORT: 2181 23 | zk_id: "1" 24 | ports: 25 | - "2181:2181" 26 | kafka: 27 | hostname: kafka 28 | image: confluentinc/cp-enterprise-kafka:5.4.0 29 | links: 30 | - zookeeper 31 | ports: 32 | - "9092:9092" 33 | environment: 34 | KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" 35 | KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://:9092" 36 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 37 | KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 38 | KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 39 | schema-registry: 40 | image: confluentinc/cp-schema-registry:5.4.0 41 | links: 42 | - kafka 43 | - zookeeper 44 | ports: 45 | - "8081:8081" 46 | environment: 47 | SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: "zookeeper:2181" 48 | SCHEMA_REGISTRY_HOST_NAME: schema-registry 49 | control-center: 50 | image: confluentinc/cp-enterprise-control-center:5.4.0 51 | depends_on: 52 | - zookeeper 53 | - kafka 54 | - schema-registry 55 | ports: 56 | - "9021:9021" 57 | environment: 58 | CONTROL_CENTER_BOOTSTRAP_SERVERS: "kafka:9092" 59 | CONTROL_CENTER_ZOOKEEPER_CONNECT: "zookeeper:2181" 60 | CONTROL_CENTER_CONNECT_CLUSTER: 'connect:8083' 61 | CONTROL_CENTER_REPLICATION_FACTOR: 1 62 | CONTROL_CENTER_CONFLUENT_CONTROLCENTER_SCHEMA_REGISTRY_URL: "http://schema-registry:8081" 63 | CONTROL_CENTER_SCHEMA_REGISTRY_URL: "http://schema-registry:8081" -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | ${groupId} 7 | ${artifactId} 8 | ${version} 9 | jar 10 | 11 | ${artifactId} 12 | A Kafka Connect Connector for ${artifactId} 13 | 14 | 15 | com.github.jcustenborder.kafka.connect 16 | kafka-connect-parent 17 | 2.4.0 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-checkstyle-plugin 35 | 36 | true 37 | 38 | 39 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/assembly/package.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | package 7 | 8 | dir 9 | 10 | false 11 | 12 | 13 | ${project.basedir} 14 | share/doc/${project.name}/ 15 | 16 | README* 17 | LICENSE* 18 | NOTICE* 19 | licenses/ 20 | 21 | 22 | 23 | ${project.basedir}/config 24 | etc/${project.name} 25 | 26 | * 27 | 28 | 29 | 30 | 31 | 32 | share/java/${project.name} 33 | true 34 | true 35 | 36 | org.apache.kafka:connect-api 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MyConverter.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.apache.kafka.common.header.Header; 4 | import org.apache.kafka.connect.data.Schema; 5 | import org.apache.kafka.connect.data.SchemaAndValue; 6 | import org.apache.kafka.connect.storage.Converter; 7 | import org.apache.kafka.common.header.Header; 8 | import org.apache.kafka.common.header.Headers; 9 | import java.util.Map; 10 | import com.github.jcustenborder.kafka.connect.utils.config.Description; 11 | import com.github.jcustenborder.kafka.connect.utils.config.Title; 12 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationImportant; 13 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationNote; 14 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationTip; 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | 18 | @Description("This is a description of this connector and will show up in the documentation") 19 | @DocumentationImportant("This is a important information that will show up in the documentation.") 20 | @DocumentationTip("This is a tip that will show up in the documentation.") 21 | @Title("Super Converter") //This is the display name that will show up in the documentation. 22 | @DocumentationNote("This is a note that will show up in the documentation") 23 | public class MyConverter implements Converter { 24 | private static Logger log = LoggerFactory.getLogger(MyConverter.class); 25 | 26 | @Override 27 | public void configure(Map settings, boolean isKey) { 28 | //TODO: Do your setup here. 29 | } 30 | 31 | @Override 32 | public byte[] fromConnectData(String s, Schema schema, Object o) { 33 | throw new UnsupportedOperationException( 34 | "This needs to be completed" 35 | ); 36 | } 37 | 38 | @Override 39 | public byte[] fromConnectData(String topic, Headers headers, Schema schema, Object value) { 40 | throw new UnsupportedOperationException( 41 | "This converter requires Kafka 2.4.0 or higher with header support." 42 | ); 43 | } 44 | 45 | @Override 46 | public SchemaAndValue toConnectData(String s, byte[] bytes) { 47 | throw new UnsupportedOperationException( 48 | "This needs to be completed" 49 | ); 50 | } 51 | 52 | @Override 53 | public SchemaAndValue toConnectData(String topic, Headers headers, byte[] value) { 54 | throw new UnsupportedOperationException( 55 | "This converter requires Kafka 2.4.0 or higher with header support." 56 | ); 57 | } 58 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MyKeyValueTransformation.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import com.github.jcustenborder.kafka.connect.utils.config.Description; 4 | import com.github.jcustenborder.kafka.connect.utils.config.Title; 5 | import com.github.jcustenborder.kafka.connect.utils.transformation.BaseKeyValueTransformation; 6 | import org.apache.kafka.common.config.ConfigDef; 7 | import org.apache.kafka.common.config.ConfigException; 8 | import org.apache.kafka.connect.connector.ConnectRecord; 9 | import org.apache.kafka.connect.data.Schema; 10 | import org.apache.kafka.connect.data.SchemaAndValue; 11 | import org.apache.kafka.connect.errors.DataException; 12 | 13 | import java.io.IOException; 14 | import java.io.InputStream; 15 | import java.util.Map; 16 | 17 | @Title("Super Cool Transformation") 18 | @Description("This transformation will change one record to another record.") 19 | public class MyKeyValueTransformation> extends BaseKeyValueTransformation { 20 | MyKeyValueTransformationConfig config; 21 | 22 | protected MyKeyValueTransformation(boolean isKey) { 23 | super(isKey); 24 | } 25 | 26 | @Override 27 | public ConfigDef config() { 28 | return MyKeyValueTransformationConfig.config(); 29 | } 30 | 31 | @Override 32 | public void close() { 33 | 34 | } 35 | 36 | @Override 37 | protected SchemaAndValue processBytes(R record, Schema inputSchema, byte[] input) { 38 | throw new UnsupportedOperationException("This method will execute against byte arrays."); 39 | } 40 | 41 | @Override 42 | protected SchemaAndValue processString(R record, Schema inputSchema, String input) { 43 | throw new UnsupportedOperationException("This method will execute against Strings."); 44 | } 45 | 46 | @Override 47 | public void configure(Map map) { 48 | this.config = new MyKeyValueTransformationConfig(map); 49 | } 50 | 51 | /** 52 | * This implementation works against the key of the record. 53 | * @param 54 | */ 55 | public static class Key> extends MyKeyValueTransformation { 56 | public Key() { 57 | super(true); 58 | } 59 | } 60 | 61 | /** 62 | * This implementation works against the value of the record. 63 | * @param 64 | */ 65 | public static class Value> extends MyKeyValueTransformation { 66 | public Value() { 67 | super(false); 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MyKeyValueTransformationConfig.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.apache.kafka.common.config.AbstractConfig; 4 | import org.apache.kafka.common.config.ConfigDef; 5 | import org.apache.kafka.common.config.ConfigDef.Type; 6 | import org.apache.kafka.common.config.ConfigDef.Importance; 7 | import com.github.jcustenborder.kafka.connect.utils.config.ConfigKeyBuilder; 8 | 9 | import java.util.Map; 10 | 11 | 12 | public class MyKeyValueTransformationConfig extends AbstractConfig { 13 | 14 | public static final String MY_SETTING_CONFIG = "my.setting"; 15 | private static final String MY_SETTING_DOC = "This is a setting important to my connector."; 16 | 17 | public final String mySetting; 18 | 19 | public MyKeyValueTransformationConfig(Map originals) { 20 | super(config(), originals); 21 | this.mySetting = this.getString(MY_SETTING_CONFIG); 22 | } 23 | 24 | public static ConfigDef config() { 25 | return new ConfigDef() 26 | .define( 27 | ConfigKeyBuilder.of(MY_SETTING_CONFIG, Type.STRING) 28 | .documentation(MY_SETTING_DOC) 29 | .importance(Importance.HIGH) 30 | .build() 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MySinkConnector.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.apache.kafka.common.config.ConfigDef; 7 | import org.apache.kafka.connect.connector.Task; 8 | import org.apache.kafka.connect.errors.ConnectException; 9 | import org.apache.kafka.connect.sink.SinkConnector; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | 13 | import com.github.jcustenborder.kafka.connect.utils.VersionUtil; 14 | import com.github.jcustenborder.kafka.connect.utils.config.Description; 15 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationImportant; 16 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationNote; 17 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationTip; 18 | import com.github.jcustenborder.kafka.connect.utils.config.TaskConfigs; 19 | import com.github.jcustenborder.kafka.connect.utils.config.Title; 20 | 21 | /** 22 | * 23 | */ 24 | 25 | @Description("This is a description of this connector and will show up in the documentation") 26 | @DocumentationImportant("This is a important information that will show up in the documentation.") 27 | @DocumentationTip("This is a tip that will show up in the documentation.") 28 | @Title("Super Sink Connector") //This is the display name that will show up in the documentation. 29 | @DocumentationNote("This is a note that will show up in the documentation") 30 | public class MySinkConnector extends SinkConnector { 31 | /* 32 | Your connector should never use System.out for logging. All of your classes should use slf4j 33 | for logging 34 | */ 35 | private static Logger log = LoggerFactory.getLogger(MySinkConnector.class); 36 | private MySinkConnectorConfig config; 37 | 38 | @Override 39 | public List> taskConfigs(int maxTasks) { 40 | //TODO: Define the individual task configurations that will be executed. 41 | 42 | /** 43 | * This is used to schedule the number of tasks that will be running. This should not exceed maxTasks. 44 | * Here is a spot where you can dish out work. For example if you are reading from multiple tables 45 | * in a database, you can assign a table per task. 46 | */ 47 | 48 | throw new UnsupportedOperationException("This has not been implemented."); 49 | } 50 | 51 | @Override 52 | public void start(Map settings) { 53 | config = new MySinkConnectorConfig(settings); 54 | 55 | //TODO: Add things you need to do to setup your connector. 56 | 57 | /** 58 | * This will be executed once per connector. This can be used to handle connector level setup. For 59 | * example if you are persisting state, you can use this to method to create your state table. You 60 | * could also use this to verify permissions 61 | */ 62 | 63 | } 64 | 65 | 66 | 67 | 68 | 69 | @Override 70 | public void stop() { 71 | //TODO: Do things that are necessary to stop your connector. 72 | } 73 | 74 | @Override 75 | public ConfigDef config() { 76 | return MySinkConnectorConfig.config(); 77 | } 78 | 79 | @Override 80 | public Class taskClass() { 81 | //TODO: Return your task implementation. 82 | return MySinkTask.class; 83 | } 84 | 85 | @Override 86 | public String version() { 87 | return VersionUtil.version(this.getClass()); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MySinkConnectorConfig.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.apache.kafka.common.config.AbstractConfig; 4 | import org.apache.kafka.common.config.ConfigDef; 5 | import org.apache.kafka.common.config.ConfigDef.Type; 6 | import org.apache.kafka.common.config.ConfigDef.Importance; 7 | import com.github.jcustenborder.kafka.connect.utils.config.ConfigKeyBuilder; 8 | 9 | import java.util.Map; 10 | 11 | 12 | public class MySinkConnectorConfig extends AbstractConfig { 13 | 14 | public static final String MY_SETTING_CONFIG = "my.setting"; 15 | private static final String MY_SETTING_DOC = "This is a setting important to my connector."; 16 | 17 | public final String mySetting; 18 | 19 | public MySinkConnectorConfig(Map originals) { 20 | super(config(), originals); 21 | this.mySetting = this.getString(MY_SETTING_CONFIG); 22 | } 23 | 24 | public static ConfigDef config() { 25 | return new ConfigDef() 26 | .define( 27 | ConfigKeyBuilder.of(MY_SETTING_CONFIG, Type.STRING) 28 | .documentation(MY_SETTING_DOC) 29 | .importance(Importance.HIGH) 30 | .build() 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MySinkTask.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.apache.kafka.clients.consumer.OffsetAndMetadata; 4 | import org.apache.kafka.common.TopicPartition; 5 | import org.apache.kafka.connect.errors.ConnectException; 6 | import org.apache.kafka.connect.sink.SinkRecord; 7 | import org.apache.kafka.connect.sink.SinkTask; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | 11 | import java.io.IOException; 12 | import java.util.Collection; 13 | import java.util.HashSet; 14 | import java.util.Map; 15 | import java.util.Set; 16 | 17 | import com.github.jcustenborder.kafka.connect.utils.VersionUtil; 18 | 19 | public class MySinkTask extends SinkTask { 20 | /* 21 | Your connector should never use System.out for logging. All of your classes should use slf4j 22 | for logging 23 | */ 24 | private static Logger log = LoggerFactory.getLogger(MySinkTask.class); 25 | 26 | MySinkConnectorConfig config; 27 | @Override 28 | public void start(Map settings) { 29 | this.config = new MySinkConnectorConfig(settings); 30 | //TODO: Create resources like database or api connections here. 31 | } 32 | 33 | @Override 34 | public void put(Collection records) { 35 | 36 | } 37 | 38 | @Override 39 | public void flush(Map map) { 40 | 41 | } 42 | 43 | @Override 44 | public void stop() { 45 | //Close resources here. 46 | } 47 | 48 | @Override 49 | public String version() { 50 | return VersionUtil.version(this.getClass()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MySourceConnector.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.apache.kafka.common.config.ConfigDef; 7 | import org.apache.kafka.connect.connector.Task; 8 | import org.apache.kafka.connect.errors.ConnectException; 9 | import org.apache.kafka.connect.source.SourceConnector; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | 13 | import com.github.jcustenborder.kafka.connect.utils.VersionUtil; 14 | import com.github.jcustenborder.kafka.connect.utils.config.Description; 15 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationImportant; 16 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationNote; 17 | import com.github.jcustenborder.kafka.connect.utils.config.DocumentationTip; 18 | import com.github.jcustenborder.kafka.connect.utils.config.TaskConfigs; 19 | import com.github.jcustenborder.kafka.connect.utils.config.Title; 20 | 21 | @Description("This is a description of this connector and will show up in the documentation") 22 | @DocumentationImportant("This is a important information that will show up in the documentation.") 23 | @DocumentationTip("This is a tip that will show up in the documentation.") 24 | @Title("Super Source Connector") //This is the display name that will show up in the documentation. 25 | @DocumentationNote("This is a note that will show up in the documentation") 26 | public class MySourceConnector extends SourceConnector { 27 | /* 28 | Your connector should never use System.out for logging. All of your classes should use slf4j 29 | for logging 30 | */ 31 | private static Logger log = LoggerFactory.getLogger(MySourceConnector.class); 32 | private MySourceConnectorConfig config; 33 | 34 | @Override 35 | public String version() { 36 | return VersionUtil.version(this.getClass()); 37 | } 38 | 39 | @Override 40 | public void start(Map map) { 41 | config = new MySourceConnectorConfig(map); 42 | 43 | //TODO: Add things you need to do to setup your connector. 44 | } 45 | 46 | @Override 47 | public Class taskClass() { 48 | //TODO: Return your task implementation. 49 | return MySourceTask.class; 50 | } 51 | 52 | @Override 53 | public List> taskConfigs(int i) { 54 | //TODO: Define the individual task configurations that will be executed. 55 | 56 | throw new UnsupportedOperationException("This has not been implemented."); 57 | } 58 | 59 | @Override 60 | public void stop() { 61 | //TODO: Do things that are necessary to stop your connector. 62 | } 63 | 64 | @Override 65 | public ConfigDef config() { 66 | return MySourceConnectorConfig.config(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MySourceConnectorConfig.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.apache.kafka.common.config.AbstractConfig; 4 | import org.apache.kafka.common.config.ConfigDef; 5 | import org.apache.kafka.common.config.ConfigDef.Type; 6 | import org.apache.kafka.common.config.ConfigDef.Importance; 7 | import com.github.jcustenborder.kafka.connect.utils.config.ConfigKeyBuilder; 8 | import java.util.Map; 9 | 10 | 11 | 12 | public class MySourceConnectorConfig extends AbstractConfig { 13 | 14 | public static final String MY_SETTING_CONFIG = "my.setting"; 15 | private static final String MY_SETTING_DOC = "This is a setting important to my connector."; 16 | 17 | public final String mySetting; 18 | 19 | public MySourceConnectorConfig(Map originals) { 20 | super(config(), originals); 21 | this.mySetting = this.getString(MY_SETTING_CONFIG); 22 | } 23 | 24 | public static ConfigDef config() { 25 | return new ConfigDef() 26 | .define( 27 | ConfigKeyBuilder.of(MY_SETTING_CONFIG, Type.STRING) 28 | .documentation(MY_SETTING_DOC) 29 | .importance(Importance.HIGH) 30 | .build() 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/MySourceTask.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.apache.kafka.connect.data.Field; 4 | import org.apache.kafka.connect.data.Schema; 5 | import org.apache.kafka.connect.data.SchemaBuilder; 6 | import org.apache.kafka.connect.data.Struct; 7 | import org.apache.kafka.connect.errors.ConnectException; 8 | import org.apache.kafka.connect.source.SourceRecord; 9 | import org.apache.kafka.connect.source.SourceTask; 10 | import com.github.jcustenborder.kafka.connect.utils.VersionUtil; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public class MySourceTask extends SourceTask { 18 | /* 19 | Your connector should never use System.out for logging. All of your classes should use slf4j 20 | for logging 21 | */ 22 | static final Logger log = LoggerFactory.getLogger(MySourceTask.class); 23 | 24 | @Override 25 | public String version() { 26 | return VersionUtil.version(this.getClass()); 27 | } 28 | 29 | @Override 30 | public void start(Map map) { 31 | //TODO: Do things here that are required to start your task. This could be open a connection to a database, etc. 32 | } 33 | 34 | @Override 35 | public List poll() throws InterruptedException { 36 | //TODO: Create SourceRecord objects that will be sent the kafka cluster. 37 | throw new UnsupportedOperationException("This has not been implemented."); 38 | } 39 | 40 | @Override 41 | public void stop() { 42 | //TODO: Do whatever is required to stop your task. 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/main/java/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This attribute is used during documentation generation to write the introduction section. 3 | */ 4 | @Introduction("This plugin is used to add additional JSON parsing functionality to Kafka Connect.") 5 | /** 6 | * This attribute is used as the display name during documentation generation. 7 | */ 8 | @Title("${artifactId}") 9 | /** 10 | * This attribute is used to provide the owner on the connect hub. For example jcustenborder. 11 | */ 12 | @PluginOwner("${groupId}") 13 | /** 14 | * This attribute is used to provide the name of the plugin on the connect hub. 15 | */ 16 | @PluginName("${artifactId}") 17 | package ${package}; 18 | 19 | import com.github.jcustenborder.kafka.connect.utils.config.Introduction; 20 | import com.github.jcustenborder.kafka.connect.utils.config.PluginName; 21 | import com.github.jcustenborder.kafka.connect.utils.config.PluginOwner; 22 | import com.github.jcustenborder.kafka.connect.utils.config.Title; -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/DocumentationTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import com.github.jcustenborder.kafka.connect.utils.BaseDocumentationTest; 4 | 5 | public class DocumentationTest extends BaseDocumentationTest { 6 | 7 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MyConverterTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class MyConverterTest { 9 | @Test 10 | public void test() { 11 | // Congrats on a passing test! 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MyKeyValueTransformationTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class MyKeyValueTransformationTest { 9 | @Test 10 | public void test() { 11 | // Congrats on a passing test! 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MySinkConnectorTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class MySinkConnectorTest { 9 | @Test 10 | public void test() { 11 | // Congrats on a passing test! 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MySinkTaskIT.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | /** 9 | * This test can be used for integration testing with the system you are integrating with. For example 10 | * take a look at https://github.com/jcustenborder/docker-compose-junit-extension to launch docker 11 | * containers for your testing. 12 | */ 13 | public class MySinkTaskIT { 14 | @Test 15 | public void test() { 16 | // Congrats on a passing test! 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MySinkTaskTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class MySinkTaskTest { 9 | @Test 10 | public void test() { 11 | // Congrats on a passing test! 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MySourceConnectorTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class MySourceConnectorTest { 9 | @Test 10 | public void test() { 11 | // Congrats on a passing test! 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MySourceTaskIT.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | /** 9 | * This test can be used for integration testing with the system you are integrating with. For example 10 | * take a look at https://github.com/jcustenborder/docker-compose-junit-extension to launch docker 11 | * containers for your testing. 12 | */ 13 | public class MySourceTaskIT { 14 | @Test 15 | public void test() { 16 | // Congrats on a passing test! 17 | } 18 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/java/MySourceTaskTest.java: -------------------------------------------------------------------------------- 1 | package ${package}; 2 | 3 | import org.junit.jupiter.api.AfterAll; 4 | import org.junit.jupiter.api.BeforeAll; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | public class MySourceTaskTest { 9 | @Test 10 | public void test() { 11 | // Congrats on a passing test! 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/resources/archetype-resources/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test-archtype.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | mvn -B clean install 3 | 4 | ARTIFACT_ID=testconnect 5 | ARCHETYPE_VERSION='2.4.0' 6 | ARCHETYPE_TEMP=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'` 7 | PROJECT_DIR="${ARCHETYPE_TEMP}/${ARTIFACT_ID}" 8 | 9 | echo $ARCHETYPE_TEMP 10 | cd "${ARCHETYPE_TEMP}" 11 | mvn -B archetype:generate -DarchetypeGroupId=com.github.jcustenborder.kafka.connect -DarchetypeArtifactId=kafka-connect-quickstart -DarchetypeVersion=$ARCHETYPE_VERSION -Dpackage=io.confluent.examples -DgroupId=io.confluent.examples -DartifactId=$ARTIFACT_ID -DpackageName=io.confluent.examples -Dversion=1.0-SNAPSHOT 12 | cd "${PROJECT_DIR}" 13 | mvn clean package 14 | #rm -rf "${ARCHETYPE_TEMP}" 15 | echo "${ARCHETYPE_TEMP}" --------------------------------------------------------------------------------