Skip to content

Commit

Permalink
Fjern rester av transaction origin (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjerga authored Nov 7, 2023
1 parent d6b0e3a commit ed3209e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.rapidsrivers.Loeser
import no.nav.helsearbeidsgiver.felles.rapidsrivers.demandValues
import no.nav.helsearbeidsgiver.felles.rapidsrivers.interestedIn
import no.nav.helsearbeidsgiver.felles.rapidsrivers.model.Behov
import no.nav.helsearbeidsgiver.felles.rapidsrivers.publish
import no.nav.helsearbeidsgiver.felles.rapidsrivers.requireKeys
Expand All @@ -36,11 +35,8 @@ class NotifikasjonHentIdLoeser(
Key.BEHOV to BehovType.NOTIFIKASJON_HENT_ID.name
)
it.requireKeys(
Key.FORESPOERSEL_ID
)
it.interestedIn(
Key.UUID,
Key.TRANSACTION_ORIGIN // TODO slett etter overgangsperiode
Key.FORESPOERSEL_ID
)
}

Expand Down Expand Up @@ -95,17 +91,15 @@ class NotifikasjonHentIdLoeser(
DataFelt.SAK_ID to sakId.toJson(),
DataFelt.OPPGAVE_ID to oppgaveId.toJson(),
Key.FORESPOERSEL_ID to behov.forespoerselId!!.toJson(),
Key.UUID to behov[Key.UUID].asText().toJson(),
Key.TRANSACTION_ORIGIN to behov[Key.TRANSACTION_ORIGIN].asText().toJson()
Key.UUID to behov[Key.UUID].asText().toJson()
)
} else if (oppgaveId != null) {
logger.warn("Fant ikke sakId, ferdigstiller kun oppgave for ${behov.forespoerselId}!")
rapid.publish(
Key.EVENT_NAME to EventName.FORESPOERSEL_BESVART.toJson(),
DataFelt.OPPGAVE_ID to oppgaveId.toJson(),
Key.FORESPOERSEL_ID to behov.forespoerselId!!.toJson(),
Key.UUID to behov[Key.UUID].asText().toJson(),
Key.TRANSACTION_ORIGIN to behov[Key.TRANSACTION_ORIGIN].asText().toJson()
Key.UUID to behov[Key.UUID].asText().toJson()
)
} else {
"Klarte ikke hente notifikasjons-ID-er. Begge er 'null'.".also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ enum class Key(override val str: String) : IKey {
INITIATE_ID("initiateId"),
UUID("uuid"),
CLIENT_ID("client_id"),
TRANSACTION_ORIGIN("transaction_origin"), // TODO slett etter overgangsperiode
FORESPOERSEL_ID("forespoerselId"),
JOURNALPOST_ID("journalpostId"),
DATA("data"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.IKey
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.les
import no.nav.helsearbeidsgiver.felles.json.lesOrNull
import no.nav.helsearbeidsgiver.felles.rapidsrivers.demandValues
import no.nav.helsearbeidsgiver.felles.rapidsrivers.interestedIn
import no.nav.helsearbeidsgiver.felles.rapidsrivers.rejectKeys
import no.nav.helsearbeidsgiver.felles.rapidsrivers.requireKeys
import no.nav.helsearbeidsgiver.utils.json.serializer.UuidSerializer
Expand All @@ -35,11 +33,8 @@ class ForespoerselBesvartFraSimbaLoeser(
Key.EVENT_NAME to EventName.INNTEKTSMELDING_MOTTATT.name
)
it.requireKeys(
Key.FORESPOERSEL_ID
)
it.interestedIn(
Key.UUID,
Key.TRANSACTION_ORIGIN // TODO slett etter overgangsperiode
Key.FORESPOERSEL_ID
)
it.rejectKeys(
Key.BEHOV,
Expand All @@ -53,8 +48,7 @@ class ForespoerselBesvartFraSimbaLoeser(
Melding(
event = EventName.INNTEKTSMELDING_MOTTATT.name,
forespoerselId = Key.FORESPOERSEL_ID.les(UuidSerializer, this),
transaksjonId = Key.UUID.lesOrNull(UuidSerializer, this)
?: Key.TRANSACTION_ORIGIN.les(UuidSerializer, this),
transaksjonId = Key.UUID.les(UuidSerializer, this),
spinnInntektsmeldingId = null
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ sealed class ForespoerselBesvartLoeser : River.PacketListener {
Key.EVENT_NAME to EventName.FORESPOERSEL_BESVART.toJson(),
Key.BEHOV to BehovType.NOTIFIKASJON_HENT_ID.toJson(),
Key.FORESPOERSEL_ID to melding.forespoerselId.toJson(),
Key.UUID to melding.transaksjonId.toJson(),
Key.TRANSACTION_ORIGIN to melding.transaksjonId.toJson() // TODO slett etter overgangsperiode
Key.UUID to melding.transaksjonId.toJson()
)
.also {
logger.info("Publiserte melding. Se sikkerlogg for mer info.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ class ForespoerselMottattLoeser(
DataFelt.ORGNRUNDERENHET to orgnr.toJson(),
Key.IDENTITETSNUMMER to fnr.toJson(),
Key.FORESPOERSEL_ID to forespoerselId.toJson(),
Key.UUID to transaksjonId.toJson(),
Key.TRANSACTION_ORIGIN to transaksjonId.toJson() // TODO slett etter overgangsperiode
Key.UUID to transaksjonId.toJson()
)
.also {
logger.info("Publiserte melding. Se sikkerlogg for mer info.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ class InnsendingService(
rapid.publish(
Key.EVENT_NAME to EventName.INNTEKTSMELDING_MOTTATT.toJson(),
Key.UUID to uuid.toJson(),
Key.TRANSACTION_ORIGIN to uuid.toJson(), // TODO slett etter overgangsperiode
DataFelt.FORESPOERSEL_ID to redisStore.get(RedisKey.of(uuid, DataFelt.FORESPOERSEL_ID))!!.toJson(),
DataFelt.INNTEKTSMELDING_DOKUMENT to message[DataFelt.INNTEKTSMELDING_DOKUMENT.str].toJsonElement()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import no.nav.helsearbeidsgiver.felles.DataFelt
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.les
import no.nav.helsearbeidsgiver.felles.json.lesOrNull
import no.nav.helsearbeidsgiver.felles.rapidsrivers.EventListener
import no.nav.helsearbeidsgiver.felles.rapidsrivers.interestedIn
import no.nav.helsearbeidsgiver.felles.rapidsrivers.requireKeys
import no.nav.helsearbeidsgiver.felles.rapidsrivers.toJsonMap
import no.nav.helsearbeidsgiver.felles.utils.Log
Expand All @@ -30,17 +28,13 @@ class JournalfoerInntektsmeldingMottattListener(rapidsConnection: RapidsConnecti
override fun accept(): River.PacketValidation =
River.PacketValidation {
it.requireKeys(
DataFelt.INNTEKTSMELDING_DOKUMENT
)
it.interestedIn(
Key.UUID,
Key.TRANSACTION_ORIGIN // TODO slett etter overgangsperiode
DataFelt.INNTEKTSMELDING_DOKUMENT
)
}

override fun onEvent(packet: JsonMessage) {
val transaksjonId = Key.UUID.lesOrNull(UuidSerializer, packet.toJsonMap())
?: Key.TRANSACTION_ORIGIN.les(UuidSerializer, packet.toJsonMap())
val transaksjonId = Key.UUID.les(UuidSerializer, packet.toJsonMap())

MdcUtils.withLogFields(
Log.klasse(this),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ManuellOpprettSakService(private val rapidsConnection: RapidsConnection, o
JsonMessage.newMessage(
mapOf(
Key.EVENT_NAME.str to EventName.FORESPOERSEL_BESVART,
Key.TRANSACTION_ORIGIN.str to transaksjonsId,
Key.UUID.str to transaksjonsId,
Key.FORESPOERSEL_ID.str to forespoerselId,
DataFelt.SAK_ID.str to redisStore.get(RedisKey.of(transaksjonsId, DataFelt.SAK_ID))!!
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ import no.nav.helsearbeidsgiver.felles.DataFelt
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.les
import no.nav.helsearbeidsgiver.felles.json.lesOrNull
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.rapidsrivers.demandValues
import no.nav.helsearbeidsgiver.felles.rapidsrivers.interestedIn
import no.nav.helsearbeidsgiver.felles.rapidsrivers.publish
import no.nav.helsearbeidsgiver.felles.rapidsrivers.requireKeys
import no.nav.helsearbeidsgiver.felles.utils.Log
Expand All @@ -42,12 +40,9 @@ class OppgaveFerdigLoeser(
Key.EVENT_NAME to EventName.FORESPOERSEL_BESVART.name
)
it.requireKeys(
DataFelt.OPPGAVE_ID,
Key.FORESPOERSEL_ID
)
it.interestedIn(
Key.UUID,
Key.TRANSACTION_ORIGIN // TODO slett etter overgangsperiode
Key.FORESPOERSEL_ID,
DataFelt.OPPGAVE_ID
)
}
}.register(this)
Expand Down Expand Up @@ -82,8 +77,7 @@ class OppgaveFerdigLoeser(

val oppgaveId = DataFelt.OPPGAVE_ID.les(String.serializer(), melding)
val forespoerselId = Key.FORESPOERSEL_ID.les(UuidSerializer, melding)
val transaksjonId = Key.UUID.lesOrNull(UuidSerializer, melding)
?: Key.TRANSACTION_ORIGIN.les(UuidSerializer, melding)
val transaksjonId = Key.UUID.les(UuidSerializer, melding)

MdcUtils.withLogFields(
Log.oppgaveId(oppgaveId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import no.nav.helsearbeidsgiver.felles.DataFelt
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.les
import no.nav.helsearbeidsgiver.felles.json.lesOrNull
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.rapidsrivers.demandValues
import no.nav.helsearbeidsgiver.felles.rapidsrivers.interestedIn
import no.nav.helsearbeidsgiver.felles.rapidsrivers.publish
import no.nav.helsearbeidsgiver.felles.rapidsrivers.requireKeys
import no.nav.helsearbeidsgiver.felles.utils.Log
Expand All @@ -43,12 +41,9 @@ class SakFerdigLoeser(
Key.EVENT_NAME to EventName.FORESPOERSEL_BESVART.name
)
it.requireKeys(
DataFelt.SAK_ID,
Key.FORESPOERSEL_ID
)
it.interestedIn(
Key.UUID,
Key.TRANSACTION_ORIGIN // TODO slett etter overgangsperiode
Key.FORESPOERSEL_ID,
DataFelt.SAK_ID
)
}
}.register(this)
Expand Down Expand Up @@ -83,8 +78,7 @@ class SakFerdigLoeser(

val sakId = DataFelt.SAK_ID.les(String.serializer(), melding)
val forespoerselId = Key.FORESPOERSEL_ID.les(UuidSerializer, melding)
val transaksjonId = Key.UUID.lesOrNull(UuidSerializer, melding)
?: Key.TRANSACTION_ORIGIN.les(UuidSerializer, melding)
val transaksjonId = Key.UUID.les(UuidSerializer, melding)

MdcUtils.withLogFields(
Log.sakId(sakId),
Expand Down

0 comments on commit ed3209e

Please sign in to comment.