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( ...@@ -197,6 +197,7 @@ class KafkaTopology(
updateInstitutionContainer(value.second, value.first) updateInstitutionContainer(value.second, value.first)
value value
} }
.filter { _, value -> value.first.hasContent() }
.map { key, value -> KeyValue("$key#update", value) } .map { key, value -> KeyValue("$key#update", value) }
.mapValues { value -> JsonUtility.queryToJson(value.first.build()) } .mapValues { value -> JsonUtility.queryToJson(value.first.build()) }
.to(updateTopic) .to(updateTopic)
......
...@@ -40,6 +40,10 @@ class UpdateQueryBuilder(private val value: String) { ...@@ -40,6 +40,10 @@ class UpdateQueryBuilder(private val value: String) {
params[targetField] = institutions params[targetField] = institutions
} }
fun hasContent(): Boolean {
return sourceLines.size > 0
}
fun build(): UpdateQuery { fun build(): UpdateQuery {
return UpdateQuery( return UpdateQuery(
recordSetFacetTerm, 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