mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-19 17:26:51 +00:00
Do not return specific status code based on remote status code
This commit is contained in:
parent
51cf7a7917
commit
35cb258b13
@ -42,7 +42,7 @@ class RequestProcessor(
|
|||||||
|
|
||||||
private val logger = LoggerFactory.getLogger(RequestProcessor::class.java)
|
private val logger = LoggerFactory.getLogger(RequestProcessor::class.java)
|
||||||
|
|
||||||
fun processMtbFile(mtbFile: MtbFile): RequestStatus {
|
fun processMtbFile(mtbFile: MtbFile) {
|
||||||
val pid = mtbFile.patient.id
|
val pid = mtbFile.patient.id
|
||||||
val pseudonymized = pseudonymizeService.pseudonymize(mtbFile)
|
val pseudonymized = pseudonymizeService.pseudonymize(mtbFile)
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class RequestProcessor(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||||
return RequestStatus.DUPLICATION
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val request = MtbFileSender.MtbFileRequest(UUID.randomUUID().toString(), pseudonymized)
|
val request = MtbFileSender.MtbFileRequest(UUID.randomUUID().toString(), pseudonymized)
|
||||||
@ -115,11 +115,9 @@ class RequestProcessor(
|
|||||||
)
|
)
|
||||||
|
|
||||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||||
|
|
||||||
return requestStatus
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun processDeletion(patientId: String): RequestStatus {
|
fun processDeletion(patientId: String) {
|
||||||
val requestId = UUID.randomUUID().toString()
|
val requestId = UUID.randomUUID().toString()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -178,10 +176,6 @@ class RequestProcessor(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
|
||||||
|
|
||||||
return overallRequestStatus
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
requestRepository.save(
|
requestRepository.save(
|
||||||
Request(
|
Request(
|
||||||
@ -194,11 +188,8 @@ class RequestProcessor(
|
|||||||
report = Report("Fehler bei der Pseudonymisierung")
|
report = Report("Fehler bei der Pseudonymisierung")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
|
||||||
|
|
||||||
return RequestStatus.ERROR
|
|
||||||
}
|
}
|
||||||
|
statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fingerprint(mtbFile: MtbFile): String {
|
private fun fingerprint(mtbFile: MtbFile): String {
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package dev.dnpm.etl.processor.web
|
package dev.dnpm.etl.processor.web
|
||||||
|
|
||||||
import de.ukw.ccc.bwhc.dto.MtbFile
|
import de.ukw.ccc.bwhc.dto.MtbFile
|
||||||
import dev.dnpm.etl.processor.monitoring.RequestStatus
|
|
||||||
import dev.dnpm.etl.processor.services.RequestProcessor
|
import dev.dnpm.etl.processor.services.RequestProcessor
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
@ -35,24 +34,16 @@ class MtbFileController(
|
|||||||
|
|
||||||
@PostMapping(path = ["/mtbfile"])
|
@PostMapping(path = ["/mtbfile"])
|
||||||
fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity<Void> {
|
fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity<Void> {
|
||||||
val requestStatus = requestProcessor.processMtbFile(mtbFile)
|
logger.debug("Accepted MTB File for processing")
|
||||||
|
requestProcessor.processMtbFile(mtbFile)
|
||||||
return if (requestStatus == RequestStatus.ERROR) {
|
return ResponseEntity.accepted().build()
|
||||||
ResponseEntity.unprocessableEntity().build()
|
|
||||||
} else {
|
|
||||||
ResponseEntity.noContent().build()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping(path = ["/mtbfile/{patientId}"])
|
@DeleteMapping(path = ["/mtbfile/{patientId}"])
|
||||||
fun deleteData(@PathVariable patientId: String): ResponseEntity<Void> {
|
fun deleteData(@PathVariable patientId: String): ResponseEntity<Void> {
|
||||||
val requestStatus = requestProcessor.processDeletion(patientId)
|
logger.debug("Accepted patient ID to process deletion")
|
||||||
|
requestProcessor.processDeletion(patientId)
|
||||||
return if (requestStatus == RequestStatus.ERROR) {
|
return ResponseEntity.accepted().build()
|
||||||
ResponseEntity.unprocessableEntity().build()
|
|
||||||
} else {
|
|
||||||
ResponseEntity.noContent().build()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,5 +3,7 @@ spring:
|
|||||||
bootstrap-servers: ${app.kafka.servers}
|
bootstrap-servers: ${app.kafka.servers}
|
||||||
template:
|
template:
|
||||||
default-topic: ${app.kafka.topic}
|
default-topic: ${app.kafka.topic}
|
||||||
|
consumer:
|
||||||
|
group-id: ${app.kafka.group-id}
|
||||||
flyway:
|
flyway:
|
||||||
locations: "classpath:db/migration/{vendor}"
|
locations: "classpath:db/migration/{vendor}"
|
Loading…
x
Reference in New Issue
Block a user