Commit bdefbd5b authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Abort sending an update when there is no lines to send.

parent 76845c21
Pipeline #26633 passed with stages
in 4 minutes and 17 seconds
......@@ -197,6 +197,7 @@ class KafkaTopology(
updateInstitutionContainer(value.second, value.first)
value
}
.filter { _, value -> value.first.hasContent() }
.map { key, value -> KeyValue("$key#update", value) }
.mapValues { value -> JsonUtility.queryToJson(value.first.build()) }
.to(updateTopic)
......
......@@ -40,6 +40,10 @@ class UpdateQueryBuilder(private val value: String) {
params[targetField] = institutions
}
fun hasContent(): Boolean {
return sourceLines.size > 0
}
fun build(): UpdateQuery {
return UpdateQuery(
recordSetFacetTerm,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment