You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Added GlobalKTables as the main data structure to store the keys and topics for each gateway.
- Added SerDe (Serializer and Deserializer) to create a local custom data structure to facilitate searching for data (will transform in hashmap/hashset in the future) that is shared by all the local streams instances appointed to it.
Copy file name to clipboardExpand all lines: code/kafka-streams-module-demo/src/main/kotlin/com/isel/kafkastreamsmoduledemo/kafkaStreamsExperimentations/GlobalKTables.kt
Copy file name to clipboardExpand all lines: code/kafka-streams-module-demo/src/main/kotlin/com/isel/kafkastreamsmoduledemo/kafkaStreamsExperimentations/KStreamsHandler.kt
val consumer:KafkaConsumer<Long, String> =KafkaConsumer(props)
287
-
288
-
consumer.subscribe(topics)
289
-
290
-
thread {
291
-
while (true) {
292
-
consumer.poll(Duration.ofSeconds(5)).forEach { record ->
293
-
println("[${System.currentTimeMillis()}] - Consumer key: [${record.key()}] and value[${record.value()}] from topic:[${record.topic()}] and timestamp [${record.timestamp()}]")
for (topicKeys in keyStorage.get(gateway).value()) {
134
+
if (topicKeys.topic == inputTopic) {
135
+
for (topicKey in topicKeys.keys) {
136
+
if (topicKey == key) {
137
+
returntrue
138
+
}
139
+
}
140
+
}
141
+
}
142
+
returnfalse
143
+
}
144
+
145
+
funcheckStreamMetadata(topic:String) {
146
+
val stream:KafkaStreams?= utils.streamsMap.get(topic)
147
+
if (stream ==null) {
148
+
println("checkStreamMetadata for stream of topic [$topic] failed.")
149
+
return
150
+
}
151
+
checkStreamMetadata(stream)
152
+
}
153
+
154
+
funcheckStreamMetadata(stream:KafkaStreams) {
155
+
156
+
stream.metrics().forEach {
157
+
println("metric name [${it.key}]")
158
+
println("metric value name [${it.value.metricName().name()}], group [${it.value.metricName().group()}], description [${it.value.metricName().description()}] and tags [${it.value.metricName().tags().toString()}]")
159
+
println("metric value:")
160
+
println(it.value.metricValue().toString())
161
+
}
162
+
163
+
}
164
+
165
+
/**
166
+
* Function responsible for logging to the console the received records
0 commit comments