Skip to content

Commit

Permalink
Sender nå kun ut behandlingsutfall når vi veit at vi oppdaterer infot…
Browse files Browse the repository at this point in the history
…rygd
  • Loading branch information
MikAoJk committed Sep 6, 2019
1 parent a1fcd28 commit 8ed5be8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/main/kotlin/no/nav/syfo/Bootstrap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,10 @@ suspend fun handleMessage(
jedis,
kafkaproducerreceivedSykmelding,
infotrygdRetryTopic,
oppgaveTopic)

sendRuleCheckValidationResult(
receivedSykmelding,
oppgaveTopic,
kafkaproducervalidationResult,
validationResult,
sm2013BehandlingsUtfallToipic,
loggingMeta)
sm2013BehandlingsUtfallToipic
)

val currentRequestLatency = requestLatency.observeDuration()

Expand Down
25 changes: 20 additions & 5 deletions src/main/kotlin/no/nav/syfo/services/UpdateInfotrygdService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import no.nav.syfo.model.ValidationResult
import no.nav.syfo.produceManualTask
import no.nav.syfo.rules.sortedSMInfos
import no.nav.syfo.sak.avro.ProduceTask
import no.nav.syfo.sendRuleCheckValidationResult
import no.nav.syfo.sortedFOMDate
import no.nav.syfo.unmarshal
import no.nav.syfo.util.xmlObjectWriter
Expand All @@ -55,7 +56,9 @@ class UpdateInfotrygdService {
jedis: Jedis,
kafkaproducerreceivedSykmelding: KafkaProducer<String, ReceivedSykmelding>,
infotrygdRetryTopic: String,
oppgaveTopic: String
oppgaveTopic: String,
kafkaproducervalidationResult: KafkaProducer<String, ValidationResult>,
sm2013BehandlingsUtfallToipic: String
) {
val helsepersonell = norskHelsenettClient.finnBehandler(receivedSykmelding.personNrLege, receivedSykmelding.msgId)

Expand All @@ -65,7 +68,7 @@ class UpdateInfotrygdService {
validationResult.status in arrayOf(Status.MANUAL_PROCESSING) ->
produceManualTask(kafkaproducerCreateTask, receivedSykmelding, validationResult,
navKontorManuellOppgave, loggingMeta, oppgaveTopic)
else -> sendInfotrygdOppdatering(
else -> sendInfotrygdOppdateringAndValidationResult(
infotrygdOppdateringProducer,
session,
loggingMeta,
Expand All @@ -75,7 +78,10 @@ class UpdateInfotrygdService {
navKontorLokalKontor,
jedis,
kafkaproducerreceivedSykmelding,
infotrygdRetryTopic)
infotrygdRetryTopic,
kafkaproducervalidationResult,
sm2013BehandlingsUtfallToipic,
validationResult)
}

log.info("Message(${StructuredArguments.fields(loggingMeta)}) got outcome {}, {}, processing took {}s",
Expand All @@ -96,7 +102,7 @@ class UpdateInfotrygdService {
}
}

suspend fun sendInfotrygdOppdatering(
suspend fun sendInfotrygdOppdateringAndValidationResult(
producer: MessageProducer,
session: Session,
loggingMeta: LoggingMeta,
Expand All @@ -106,7 +112,10 @@ suspend fun sendInfotrygdOppdatering(
navKontorNr: String,
jedis: Jedis,
kafkaproducerreceivedSykmelding: KafkaProducer<String, ReceivedSykmelding>,
infotrygdRetryTopic: String
infotrygdRetryTopic: String,
kafkaproducervalidationResult: KafkaProducer<String, ValidationResult>,
sm2013BehandlingsUtfallToipic: String,
validationResult: ValidationResult
) {
val perioder = itfh.healthInformation.aktivitet.periode.sortedBy { it.periodeFOMDato }
val marshalledFellesformat = receivedSykmelding.fellesformat
Expand Down Expand Up @@ -139,6 +148,12 @@ suspend fun sendInfotrygdOppdatering(
perioder.drop(1).forEach { periode ->
sendInfotrygdOppdateringMq(producer, session, createInfotrygdFellesformat(marshalledFellesformat, itfh, periode, personNrPasient, signaturDato, behandlerKode, tssid, loggingMeta, navKontorNr, forsteFravaersDag, 2), loggingMeta)
}
sendRuleCheckValidationResult(
receivedSykmelding,
kafkaproducervalidationResult,
validationResult,
sm2013BehandlingsUtfallToipic,
loggingMeta)
}
}
} catch (connectionException: JedisConnectionException) {
Expand Down

0 comments on commit 8ed5be8

Please sign in to comment.