-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
110 lines (91 loc) · 3.75 KB
/
build.gradle
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
plugins {
id 'java'
id "com.github.imflog.kafka-schema-registry-gradle-plugin" version "1.12.0"
id "com.github.davidmc24.gradle.plugin.avro" version "1.9.1"
id 'com.github.eirnym.js2p' version '1.0'
}
group = 'io.doubledispatch'
version = '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
maven {
url "https://packages.confluent.io/maven/"
}
}
java {
sourceCompatibility = '17'
}
dependencies {
implementation 'org.apache.avro:avro:1.11.3'
implementation 'org.apache.kafka:kafka-streams:3.4.0'
implementation 'io.confluent:kafka-streams-avro-serde:7.4.0'
implementation 'io.confluent:kafka-streams-json-schema-serde:7.4.0'
implementation "io.confluent:kafka-avro-serializer:7.4.0"
implementation "io.confluent:kafka-json-schema-serializer:7.4.0"
implementation "org.apache.logging.log4j:log4j-api:2.12.4"
implementation 'org.apache.logging.log4j:log4j-core:2.12.4'
implementation "org.apache.logging.log4j:log4j-slf4j-impl:2.12.4"
implementation 'org.slf4j:slf4j-simple:2.0.10'
}
jsonSchema2Pojo {
targetPackage = 'io.doubledispatch.kafka.multiple_event_types.json'
generateBuilders = true
annotationStyle = "JACKSON2"
source = files("${project.projectDir}/src/main/json")
targetDirectory = file("${project.buildDir}/generated-main-json-java")
includeJsr303Annotations = false
propertyWordDelimiters = ['_'] as char[]
}
tasks.named('test') {
useJUnitPlatform()
}
schemaRegistry {
def props = new Properties()
file("src/main/resources/config.properties").withInputStream {props.load(it)}
def srUrl = props.getProperty("schema.registry.url")
//def auth = props.getProperty("basic.auth.user.info").split(":")
//println "Using Schema Registry endpoint:${srUrl}, username:${auth[0]},password:${auth[1]}"
println "Using Schema Registry endpoint:${srUrl}"
url = srUrl
/*
credentials {
// username is the characters up to the ':' in the basic.auth.user.info property
username = auth[0]
// password is everything after ':' in the basic.auth.user.info property
password = auth[1]
}
*/
// Possible types are ["JSON", "AVRO"]
register {
subject('page-view', 'src/main/avro/page_view.avsc', 'AVRO')
subject('purchase', 'src/main/avro/purchase.avsc', 'AVRO')
subject('avro-events-value', 'src/main/avro/all_events.avsc', 'AVRO')
.addReference("io.doubledispatch.kafka.multiple_event_types.avro.PageView", "page-view", 1)
.addReference("io.doubledispatch.kafka.multiple_event_types.avro.Purchase", "purchase", 1)
subject('json-page-view', 'src/main/json/page_view.json', 'JSON')
subject('json-purchase', 'src/main/json/purchase.json', 'JSON')
subject('json-events-value', 'src/main/json/all_events.json', 'JSON')
.addReference("page_view.json", "json-page-view", 1)
.addReference("purchase.json", "json-purchase", 1)
}
}
task createTopics(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'io.doubledispatch.kafka.utils.KafkaTopicsCreator'
args 'src/main/resources/config.properties'
}
task runProducer(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'io.doubledispatch.kafka.multiple_event_types.DataProducer'
args 'src/main/resources/config.properties'
}
task runKafkaStreamsExample(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'io.confluent.developer.streams.MultiEventKafkaStreamsExample'
args 'src/main/resources/config.properties'
}
task runConsumer(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'io.doubledispatch.kafka.multiple_event_types.MultiEventConsumer'
args 'src/main/resources/config.properties'
}