├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── CONTRIBUTORS.md
├── LICENSE.txt
├── NOTICE.txt
├── README.md
├── RELEASING.md
├── checkstyle
├── checkstyle-config.xml
└── checkstyle-suppressions.xml
├── common-kafka-connect
├── README.md
├── pom.xml
└── src
│ ├── etc
│ └── findbugs-exclude.xml
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── cerner
│ │ │ └── common
│ │ │ └── kafka
│ │ │ └── connect
│ │ │ ├── Version.java
│ │ │ └── kafka
│ │ │ ├── KafkaSinkConnector.java
│ │ │ └── KafkaSinkTask.java
│ └── resources
│ │ └── common-kafka-connect.properties
│ └── test
│ ├── java
│ └── com
│ │ └── cerner
│ │ └── common
│ │ └── kafka
│ │ └── connect
│ │ ├── VersionTest.java
│ │ └── kafka
│ │ ├── KafkaSinkConnectorTest.java
│ │ └── KafkaSinkTaskTest.java
│ └── resources
│ └── log4j.properties
├── common-kafka-test
├── README.md
├── pom.xml
└── src
│ ├── etc
│ └── findbugs-exclude.xml
│ └── main
│ └── java
│ └── com
│ └── cerner
│ └── common
│ └── kafka
│ └── testing
│ ├── AbstractKafkaTests.java
│ ├── KafkaBrokerTestHarness.java
│ └── KafkaTestUtils.java
├── common-kafka
├── README.md
├── pom.xml
└── src
│ ├── etc
│ └── findbugs-exclude.xml
│ ├── main
│ └── java
│ │ └── com
│ │ └── cerner
│ │ └── common
│ │ └── kafka
│ │ ├── KafkaExecutionException.java
│ │ ├── TopicPartitionComparator.java
│ │ ├── consumer
│ │ ├── ConsumerOffsetClient.java
│ │ ├── ProcessingConfig.java
│ │ ├── ProcessingKafkaConsumer.java
│ │ ├── ProcessingPartition.java
│ │ └── assignors
│ │ │ └── FairAssignor.java
│ │ ├── metrics
│ │ └── MeterPool.java
│ │ └── producer
│ │ ├── KafkaProducerPool.java
│ │ ├── KafkaProducerWrapper.java
│ │ └── partitioners
│ │ └── FairPartitioner.java
│ └── test
│ ├── java
│ └── com
│ │ └── cerner
│ │ └── common
│ │ └── kafka
│ │ ├── KafkaTests.java
│ │ ├── StandaloneTests.java
│ │ ├── consumer
│ │ ├── ConsumerOffsetClientTest.java
│ │ ├── ProcessingConfigTest.java
│ │ ├── ProcessingKafkaConsumerITest.java
│ │ ├── ProcessingKafkaConsumerRebalanceIT.java
│ │ ├── ProcessingKafkaConsumerTest.java
│ │ ├── ProcessingPartitionTest.java
│ │ └── assignors
│ │ │ └── FairAssignorTest.java
│ │ ├── metrics
│ │ └── MeterPoolTest.java
│ │ └── producer
│ │ ├── KafkaProducerPoolTest.java
│ │ ├── KafkaProducerWrapperTest.java
│ │ └── partitioners
│ │ └── FairPartitionerTest.java
│ └── resources
│ └── log4j.properties
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .idea/
3 | *.iml
4 | */generated/
5 | */dependency-reduced-pom.xml
6 | **/.settings
7 | **/.project
8 | **/.classpath
9 | .ruby-version
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | dist: trusty
3 | jdk: oraclejdk8
4 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Help us to make this project better by contributing. Whether it's new features, bug fixes, or simply improving documentation, your contributions are welcome. Please start with logging a [github issue][1] or submit a pull request.
4 |
5 | Before you contribute, please review these guidelines to help ensure a smooth process for everyone.
6 |
7 | Thanks.
8 |
9 | ## Issue reporting
10 |
11 | * Please browse our [existing issues][1] before logging new issues.
12 | * Check that the issue has not already been fixed in the `master` branch.
13 | * Open an issue with a descriptive title and a summary.
14 | * Please be as clear and explicit as you can in your description of the problem.
15 | * Please state the version of common-kafka and kafka you are using in the description.
16 | * Include any relevant code in the issue summary.
17 |
18 | ## Pull requests
19 |
20 | * Read [how to properly contribute to open source projects on Github][2].
21 | * Fork the project.
22 | * Use a feature branch.
23 | * Write [good commit messages][3].
24 | * Use the same coding conventions as the rest of the project.
25 | * Commit locally and push to your fork until you are happy with your contribution.
26 | * Make sure to add tests and verify all the tests are passing when merging upstream.
27 | * Add an entry to the [Changelog][4] accordingly.
28 | * Please add your name to the CONTRIBUTORS.md file. Adding your name to the CONTRIBUTORS.md file signifies agreement to all rights and reservations provided by the [License][5].
29 | * [Squash related commits together][6].
30 | * Open a [pull request][7].
31 | * The pull request will be reviewed by the community and merged by the project committers.
32 |
33 | [1]: https://github.com/cerner/common-kafka/issues
34 | [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
35 | [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
36 | [4]: ./CHANGELOG.md
37 | [5]: ./LICENSE.txt
38 | [6]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
39 | [7]: https://help.github.com/articles/using-pull-requests
40 |
--------------------------------------------------------------------------------
/CONTRIBUTORS.md:
--------------------------------------------------------------------------------
1 | * Cerner Corporation
2 | * Bryan Baugher [@bbaugher][bryan-baugher]
3 | * Andrew Olson [@noslowerdna][andrew-olson]
4 | * Micah Whitacre [@mkwhitacre][micah-whitacre]
5 | * Cole Skoviak [@EdwardSkoviak][cole-skoviak]
6 | * Pooja Dhondge [@dhondgepooja][pooja-dhondge]
7 | * Brian Tieman
8 | * Stephen Durfey
9 | * Greg Whitsitt
10 | * Matt Garlock [@matt-garlock][matt-garlock]
11 |
12 | [bryan-baugher]: https://github.com/bbaugher
13 | [andrew-olson]: https://github.com/noslowerdna
14 | [cole-skoviak]: https://github.com/EdwardSkoviak
15 | [micah-whitacre]: https://github.com/mkwhitacre
16 | [pooja-dhondge]: https://github.com/dhondgepooja
17 | [matt-garlock]: https://github.com/matt-garlock
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/NOTICE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2017 Cerner Innovation, Inc.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Common Kafka [](https://travis-ci.com/cerner/common-kafka)
2 |
3 |
4 | This repository contains common Kafka code supporting Cerner's cloud-based solutions.
5 |
6 | For Maven, add the following,
7 |
8 | ```
9 |
10 |
11 | com.cerner.common.kafka
12 | common-kafka
13 | 3.0
14 |
15 |
16 |
17 | com.cerner.common.kafka
18 | common-kafka-connect
19 | 3.0
20 |
21 |
22 |
23 | com.cerner.common.kafka
24 | common-kafka-test
25 | 3.0
26 |
27 | ```
28 |
29 | ## Project Inventory
30 |
31 | The following modules are available for use,
32 |
33 | * [common-kafka](common-kafka/README.md): Lightweight wrapper for
34 | [producers](http://kafka.apache.org/32/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html)
35 | and [consumers](http://kafka.apache.org/32/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html)
36 | in the [kafka-clients](https://github.com/apache/kafka/tree/trunk/clients) library.
37 | * [common-kafka-connect](common-kafka-connect/README.md): Contains
38 | [Kafka Connect](http://kafka.apache.org/documentation.html#connect) component implementations.
39 | * [common-kafka-test](common-kafka-test/README.md): Provides infrastructure for integration or "heavy"
40 | unit tests that need a running Kafka broker and ZooKeeper service.
41 |
42 | Please refer to the project-specific README documentation for content details.
43 |
44 | ## Version Requirements
45 |
46 | The 3.0 release of common-kafka uses the following dependency versions.
47 |
48 | * [Kafka](http://kafka.apache.org/): 3.2.0
49 | * [Metrics](http://metrics.dropwizard.io/): 2.2.0
50 | * [Scala](https://scala-lang.org/): 2.13.5
51 |
52 | Note that the Scala dependency is only applicable for common-kafka-test.
53 |
54 | ## Upgrading from common-kafka 2.x to 3.0
55 |
56 | * The common-kafka-admin module has been removed, KafkaAdminClient can be replaced by Kafka's [admin client](https://github.com/apache/kafka/blob/3.2.0/clients/src/main/java/org/apache/kafka/clients/admin/AdminClient.java)
57 | * KafkaBrokerTestHarness has been updated to require TestInfo in the setup method, which requires junit5.
58 | By extending AbstractKafkaTests instead of using KafkaBrokerTestHarness directly you can avoid needing to add a junit5 dependency.
59 |
60 | ## Contribute
61 |
62 | You are welcome to contribute to Common-Kafka.
63 |
64 | Read our [Contribution guidelines](CONTRIBUTING.md).
65 |
66 | ## License
67 |
68 | ```
69 | Copyright 2017 Cerner Innovation, Inc.
70 |
71 | Licensed under the Apache License, Version 2.0 (the "License");
72 | you may not use this file except in compliance with the License.
73 | You may obtain a copy of the License at
74 |
75 | http://www.apache.org/licenses/LICENSE-2.0
76 |
77 | Unless required by applicable law or agreed to in writing, software
78 | distributed under the License is distributed on an "AS IS" BASIS,
79 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80 | See the License for the specific language governing permissions and
81 | limitations under the License.
82 |
--------------------------------------------------------------------------------
/RELEASING.md:
--------------------------------------------------------------------------------
1 | Releasing
2 | =========
3 |
4 | Setup / First Time
5 | ------------------
6 |
7 | If you have never released before you will need to do the following,
8 |
9 | * Your user will need access to the maven central repo for our group (`com.cerner.common.kafka`)
10 | * Create a [JIRA account](https://issues.sonatype.org/secure/Signup!default.jspa)
11 | * Log a ticket ([like this one](https://issues.sonatype.org/browse/OSSRH-37290)) to get access to the repo. You will need one of the owners of the project to approve the JIRA
12 | * Install gpg (for Mac `brew install gnupg`)
13 | * Setup gpg key (http://central.sonatype.org/pages/working-with-pgp-signatures.html)
14 | * Create new key `gpg --gen-key`. Follow instructions
15 | * Share public key `gpg --keyserver pgp.mit.edu --send-keys KEY_ID`
16 | * Add the following to `~/.m2/settings.xml`
17 |
18 | ```
19 |
20 |
21 |
22 | ossrh
23 | JIRA_USER
24 | JIRA_PASSWORD
25 |
26 |
27 |
28 | ```
29 |
30 | * You can also setup your gpg passphrase into `settings.xml` following [this](http://central.sonatype.org/pages/apache-maven.html#gpg-signed-components) but I was unable to get it to work
31 |
32 | Releasing the Project
33 | ---------------------
34 |
35 | If you've done the setup to release the project do the following,
36 |
37 | `mvn release:clean release:prepare release:perform -P ossrh`
38 |
39 | This will,
40 |
41 | * Drop `-SNAPSHOT` from version
42 | * Create a git tag
43 | * Bump version and add `-SNAPSHOT` for next development
44 | * Push artifact to [staging](https://oss.sonatype.org)
45 |
46 | At this point you can check the artifacts if you would like in the
47 | [staging repo](https://oss.sonatype.org). If everything looks good you can then do,
48 |
49 | `mvn nexus-staging:release -P ossrh -DstagingRepositoryId=REPO_ID`
50 |
51 | This promotes the artifacts from staging to public maven central.
52 |
53 | You can get the `REPO_ID` either look for,
54 | `Closing staging repository with ID "comcernercommonkafka-1002"`
55 | in the maven logs or from the [staging repo](https://oss.sonatype.org).
56 |
57 | ### Common Issues
58 |
59 | #### gpg: signing failed: Inappropriate ioctl for device
60 |
61 | If the gpg maven plugin gives you the error `gpg: signing failed: Inappropriate ioctl for device`
62 | you can try doing,
63 |
64 | ```
65 | GPG_TTY=$(tty)
66 | export GPG_TTY
67 | ```
68 |
69 | #### Maven Fails to Commit/Push
70 |
71 | If the maven release plugin fails to commit things to git or create tags you can try
72 | the following,
73 |
74 | `git config --add status.displayCommentPrefix true`
75 |
76 | #### Unhandled: Repository: comcernercommonkafka-XXXX has invalid state: open
77 |
78 | If the staging repository promotion command fails with
79 | `Unhandled: Repository: comcernercommonkafka-1001 has invalid state: open`
80 | this likely means the project doesn't meet some requirement of the sonatype
81 | repo. You can attempt to manually close the repo via the
82 | [staging repo](https://oss.sonatype.org) webUI which will prep it to be
83 | promoted. It should run the staged artifacts through a check process and
84 | fail for any issues.
85 |
86 | #### Rule failure: No public key: Key with id: XXXXXX
87 |
88 | This means that one of the sonatype repository rules about having a valid GPG key
89 | failed and they were unable to find your key in any of the public key servers.
90 |
91 | Pushing your gpg key to a public key server should likely fix the issue,
92 |
93 | ```
94 | gpg --send-key KEY_ID
95 | ```
96 |
97 | Then verify with,
98 |
99 | ```
100 | gpg --recv-key KEY_ID
101 | ```
102 |
103 | If this isn't working you can try manually uploading,
104 |
105 | ```
106 | gpg --armor --export KEY_ID
107 | ```
108 |
109 | Then going to [https://pgp.mit.edu/](https://pgp.mit.edu/) and uploading the key
110 | into the UI.
111 |
112 | Another option I've found that worked when the others didn't was to use another
113 | keyserver,
114 |
115 | ```
116 | gpg --keyserver hkp://keyserver.ubuntu.com --send-key KEY_ID
117 | ```
118 |
119 | And verify,
120 |
121 | ```
122 | gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys KEY_ID
123 | ```
124 |
125 | Additionally this can still fail even if the key is found on the key server if
126 | your key is actually a sub key. You can see this with,
127 |
128 | ```
129 | gpg --list-keys
130 | ```
131 |
132 | If your key contains the `sub` section. If it does you likely need to delete your
133 | key(s),
134 |
135 | ```
136 | gpg --delete-secret-key KEY_ID
137 | gpg --delete-key KEY_ID
138 | ```
139 |
140 | Then generate a new key that is a 'sign only' key,
141 |
142 | ```
143 | gpg --full-generate-key
144 | ```
145 |
146 | Make sure to select the 'Sign Only' and 'RSA' options. Then follow the same options
147 | above to upload your key and verify its on the public key servers and try the
148 | release again. Release can be started again with,
149 |
150 | ```
151 | mvn release:perform -P ossrh
152 | ```
--------------------------------------------------------------------------------
/checkstyle/checkstyle-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/checkstyle/checkstyle-suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/common-kafka-connect/README.md:
--------------------------------------------------------------------------------
1 | # common-kafka-connect
2 |
3 | This project contains [Kafka Connect]((http://kafka.apache.org/documentation.html#connect)) component
4 | implementations.
5 |
6 | The primary classes available for use are listed below.
7 |
8 | ## Sources
9 |
10 | No Kafka Connect Sources are currently provided.
11 |
12 | ## Sinks
13 |
14 | ### [KafkaSinkConnector](src/main/java/com/cerner/common/kafka/connect/kafka/KafkaSinkConnector.java)
15 |
16 | * A simple Kafka Connect Sink Connector that sends data to another Kafka cluster without any transformation or filtering.
17 | * Requires the use of the `org.apache.kafka.connect.converters.ByteArrayConverter` converter.
18 | * To run this connector in kafka-connect add the `common-kafka` and `commmon-kafka-connect` jars to the kafka-connect classpath.
19 |
20 | #### Configuration
21 |
22 | * `bootstrap.servers`: The list of broker host/port for the kafka cluster to send data to (Required)
23 | * `producer.*`: Kafka producer configuration. To add a particular producer config prefix it with `producer.` (i.e. `producer.acks`)
24 |
25 | By default the following is set to ensure everything is delivered,
26 |
27 | * `acks`: `all`
28 | * `max.in.flight.requests.per.connection`: `1`
29 | * `retries`: `2147483647` (i.e. `Integer.MAX_VALUE`)
30 |
31 | ### [KafkaSinkTask](src/main/java/com/cerner/common/kafka/connect/kafka/KafkaSinkTask.java)
32 |
33 | * Sink Task implementation used by the `KafkaSinkConnector`.
34 | * Does not do any deserialization or serialization of data.
35 | * Sets producer configuration to ensure strong consistency.
36 | * Writes data to the same topic and partition in the destination Kafka cluster that it was read from the source Kafka cluster.
--------------------------------------------------------------------------------
/common-kafka-connect/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 4.0.0
5 |
6 | com.cerner.common.kafka
7 | common-kafka-parent
8 | 3.1-SNAPSHOT
9 |
10 |
11 | common-kafka-connect
12 | Common Kafka Connect
13 | Common Kafka Connect
14 | ${cloud.site.url}
15 | jar
16 |
17 |
18 | ..
19 |
20 |
21 |
22 |
23 | ${cloud.site.id}
24 | ${cloud.site.name}
25 | ${cloud.site.deploy.url}
26 |
27 |
28 |
29 |
30 |
31 | org.apache.kafka
32 | connect-api
33 |
34 |
35 | com.cerner.common.kafka
36 | common-kafka
37 |
38 |
39 | org.apache.kafka
40 | kafka-clients
41 |
42 |
43 | org.slf4j
44 | slf4j-api
45 |
46 |
47 |
48 |
49 | org.junit.jupiter
50 | junit-jupiter-api
51 | test
52 |
53 |
54 | org.hamcrest
55 | hamcrest-core
56 | test
57 |
58 |
59 | org.mockito
60 | mockito-core
61 | test
62 |
63 |
64 | org.mockito
65 | mockito-junit-jupiter
66 | test
67 |
68 |
69 | org.slf4j
70 | slf4j-log4j12
71 | test
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | src/main/resources/
80 | true
81 |
82 |
83 |
84 |
85 | org.apache.maven.plugins
86 | maven-dependency-plugin
87 |
88 |
89 | org.slf4j:slf4j-log4j12:jar:${slf4j.version}
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/common-kafka-connect/src/etc/findbugs-exclude.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/common-kafka-connect/src/main/java/com/cerner/common/kafka/connect/Version.java:
--------------------------------------------------------------------------------
1 | package com.cerner.common.kafka.connect;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 |
6 | import java.io.IOException;
7 | import java.io.InputStream;
8 | import java.util.Properties;
9 |
10 | /**
11 | * Class used to determine the version of the project
12 | */
13 | // This is used in our connectors/sinks to display the version of the connector
14 | public class Version {
15 |
16 | private static final Logger LOGGER = LoggerFactory.getLogger(Version.class);
17 |
18 | private static String version = "unknown";
19 |
20 | static {
21 | try {
22 | Properties props = new Properties();
23 | try (InputStream stream = Version.class.getResourceAsStream("/common-kafka-connect.properties")) {
24 | props.load(stream);
25 | }
26 | version = props.getProperty("version", version).trim();
27 | } catch (IOException | RuntimeException e) {
28 | LOGGER.warn("Error while loading version:", e);
29 | }
30 | }
31 |
32 | /**
33 | * @return the version of the project
34 | */
35 | public static String getVersion() {
36 | return version;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/common-kafka-connect/src/main/java/com/cerner/common/kafka/connect/kafka/KafkaSinkConnector.java:
--------------------------------------------------------------------------------
1 | package com.cerner.common.kafka.connect.kafka;
2 |
3 | import com.cerner.common.kafka.connect.Version;
4 | import org.apache.kafka.clients.consumer.ConsumerConfig;
5 | import org.apache.kafka.common.config.ConfigDef;
6 | import org.apache.kafka.connect.connector.Task;
7 | import org.apache.kafka.connect.sink.SinkConnector;
8 | import org.slf4j.Logger;
9 | import org.slf4j.LoggerFactory;
10 |
11 | import java.util.Collections;
12 | import java.util.HashMap;
13 | import java.util.List;
14 | import java.util.Map;
15 | import java.util.stream.Collectors;
16 | import java.util.stream.IntStream;
17 |
18 | /**
19 | * A Kafka sink connector which forwards the configured data to another Kafka cluster
20 | */
21 | public class KafkaSinkConnector extends SinkConnector {
22 |
23 | private static final Logger LOGGER = LoggerFactory.getLogger(KafkaSinkConnector.class);
24 |
25 | public static final String PRODUCER_PREFIX = "producer.";
26 |
27 | private static final ConfigDef CONFIG_DEF = new ConfigDef()
28 | .define(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, ConfigDef.Type.STRING, ConfigDef.Importance.HIGH,
29 | "Bootstrap brokers for mirror'ed cluster");
30 |
31 | // Visible for testing
32 | protected Map config;
33 |
34 | @Override
35 | public String version() {
36 | return Version.getVersion();
37 | }
38 |
39 | @Override
40 | public void start(Map taskConfig) {
41 | config = new HashMap<>();
42 |
43 | taskConfig.forEach((key, value) -> {
44 | if (key.startsWith(PRODUCER_PREFIX)) {
45 | config.put(key.substring(PRODUCER_PREFIX.length()), value);
46 | }
47 | });
48 |
49 | config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, taskConfig.get(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG));
50 | config = Collections.unmodifiableMap(config);
51 |
52 | LOGGER.debug("Using {} for config", config);
53 | }
54 |
55 | @Override
56 | public Class extends Task> taskClass() {
57 | return KafkaSinkTask.class;
58 | }
59 |
60 | @Override
61 | public List