Skip to content

Commit e5a5c44

Browse files
authored
Merge pull request #1 from aiven/initial-checkout
Do initial code and README check-in #1
2 parents 63cd14d + fd2ffd2 commit e5a5c44

20 files changed

+1398
-21
lines changed

.gitignore

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
1-
# Compiled class file
2-
*.class
1+
.idea
32

4-
# Log file
5-
*.log
3+
# Ignore Gradle project-specific cache directory
4+
.gradle
65

7-
# BlueJ files
8-
*.ctxt
9-
10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
12-
13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
21-
22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*
6+
# Ignore Gradle build output directory
7+
build

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: java
2+
3+
git:
4+
depth: 3
5+
6+
jdk:
7+
- openjdk8
8+
- openjdk11
9+
10+
before_cache:
11+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
12+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
13+
cache:
14+
directories:
15+
- $HOME/.gradle/caches/
16+
- $HOME/.gradle/wrapper/

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Aiven Kafka Connect Transformations
2+
3+
[![Build Status](https://travis-ci.org/aiven/aiven-kafka-connect-transforms.svg?branch=master)](https://travis-ci.org/aiven/aiven-kafka-connect-transforms)
4+
5+
This is a set of [Kafka Connect transformations](https://kafka.apache.org/documentation/#connect_transforms).
6+
7+
## Transformations
8+
9+
### `ExtractTopic`
10+
11+
This transformation extracts a string value from the message and use it as the topic name.
12+
13+
The transformation can use either the whole key or value (in this case, it must have `STRING` type) or a field in them (in this case, it must have `STRUCT` type and the field's value must be `STRING`).
14+
15+
Exists in two variants:
16+
- `io.aiven.kafka.connect.transforms.ExtractTopic$Key` - works on keys;
17+
- `io.aiven.kafka.connect.transforms.ExtractTopic$Value` - works on values.
18+
19+
The transformation defines the following configurations:
20+
21+
- `field.name` - The name of the field which should be used as the topic name. If `null` or empty, the entire key or value is used (and assumed to be a string). By default is `null`.
22+
- `skip.missing.or.null` - In case the source of the new topic name is `null` or missing, should a record be silently passed without transformation. By default is `false`.
23+
24+
Here's an example of this transformation configuration:
25+
26+
```properties
27+
transforms=ExtractTopicFromValueField
28+
transforms.ExtractTopicFromValueField.field.name=inner_field_name
29+
```
30+
31+
See [the Kafka documentation](https://kafka.apache.org/documentation/#connect_transforms) for more details about configuring transformations.
32+
33+
## License
34+
35+
This project is licensed under the [Apache License, Version 2.0](LICENSE).

build.gradle

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright 2019 Aiven Oy
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+
plugins {
18+
// https://docs.gradle.org/current/userguide/java_library_plugin.html
19+
id 'java-library'
20+
21+
// https://docs.gradle.org/current/userguide/distribution_plugin.html
22+
id 'distribution'
23+
24+
// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
25+
id 'checkstyle'
26+
}
27+
28+
repositories {
29+
jcenter()
30+
}
31+
32+
sourceCompatibility = JavaVersion.VERSION_1_8
33+
targetCompatibility = JavaVersion.VERSION_1_8
34+
35+
ext {
36+
kafkaVersion = "2.0.1"
37+
}
38+
39+
distributions {
40+
main {
41+
contents {
42+
from jar
43+
from configurations.runtimeClasspath
44+
}
45+
}
46+
}
47+
48+
dependencies {
49+
compileOnly "org.apache.kafka:connect-api:$kafkaVersion"
50+
51+
implementation "org.slf4j:slf4j-api:1.7.25"
52+
53+
testImplementation "org.junit.jupiter:junit-jupiter:5.5.1"
54+
testImplementation "org.hamcrest:hamcrest:2.1"
55+
testImplementation "org.apache.kafka:connect-api:$kafkaVersion"
56+
testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:2.12.1"
57+
}
58+
59+
checkstyle {
60+
toolVersion "8.21"
61+
}
62+
63+
test {
64+
useJUnitPlatform {
65+
includeEngines 'junit-jupiter'
66+
}
67+
}
68+
69+
processResources {
70+
filesMatching('aiven-kafka-connect-transforms-version.properties') {
71+
expand(version: version)
72+
}
73+
}
74+
75+
jar {
76+
manifest {
77+
attributes(
78+
'Version': "${getArchiveVersion()}"
79+
)
80+
}
81+
}

0 commit comments

Comments
 (0)