Commit 6589be07 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Update code style

Remove unused property.
parent fe66a7fa
......@@ -50,8 +50,6 @@ class BulkProcessor(
) {
private var recordsInBulk = 0
private val mapper = ObjectMapper().registerKotlinModule()
private val updateByQueryListener = UpdateByQueryListener(serviceName, producer)
private val listener = object : BulkProcessor.Listener {
var recordsCounter = 0
override fun beforeBulk(executionId: Long, request: BulkRequest) {
......@@ -186,8 +184,8 @@ class BulkProcessor(
reports
.filter { report -> report.status == ReportStatus.fatal }
.forEach { report ->
producer.sendReport(report, it.headers())
}
producer.sendReport(report, it.headers())
}
}
}
......@@ -226,29 +224,35 @@ class BulkProcessor(
val updateQuery = try {
mapper.readValue<UpdateQuery>(consumerRecord.value(), UpdateQuery::class.java).let {
it
?: return listOf(Report(
consumerRecord.key(),
ReportStatus.fatal,
"Input message is empty.",
serviceNameUpdate
))
?: return listOf(
Report(
consumerRecord.key(),
ReportStatus.fatal,
"Input message is empty.",
serviceNameUpdate
)
)
}
} catch (ex: JsonProcessingException) {
log.error("JSON Parse Error: ${ex.localizedMessage}")
return listOf(Report(
consumerRecord.key(),
ReportStatus.fatal,
"JSON Parse Error: ${ex.localizedMessage}",
serviceNameUpdate
))
return listOf(
Report(
consumerRecord.key(),
ReportStatus.fatal,
"JSON Parse Error: ${ex.localizedMessage}",
serviceNameUpdate
)
)
} catch (ex: JsonMappingException) {
log.error("JSON Parse Error: ${ex.localizedMessage}")
return listOf(Report(
consumerRecord.key(),
ReportStatus.fatal,
"JSON Parse Error: ${ex.localizedMessage}",
serviceNameUpdate
))
return listOf(
Report(
consumerRecord.key(),
ReportStatus.fatal,
"JSON Parse Error: ${ex.localizedMessage}",
serviceNameUpdate
)
)
}
return try {
......@@ -273,22 +277,26 @@ class BulkProcessor(
}
} else {
log.info("Successfully updated ${consumerRecord.key()}.")
listOf(Report(
consumerRecord.key(),
ReportStatus.success,
"",
serviceNameUpdate
))
listOf(
Report(
consumerRecord.key(),
ReportStatus.success,
"",
serviceNameUpdate
)
)
}
} catch (ex: Exception) {
log.error("Unknown exception: ${ex.localizedMessage}")
listOf(Report(
consumerRecord.key(),
ReportStatus.fatal,
"Unknown Exception: ${ex.localizedMessage}",
serviceNameUpdate
))
listOf(
Report(
consumerRecord.key(),
ReportStatus.fatal,
"Unknown Exception: ${ex.localizedMessage}",
serviceNameUpdate
)
)
}
}
}
\ No newline at end of file
Supports Markdown
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