Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logg feil ved inaktiv service #342

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ import no.nav.helsearbeidsgiver.felles.rapidsrivers.redis.IRedisStore
import no.nav.helsearbeidsgiver.felles.rapidsrivers.redis.RedisKey
import no.nav.helsearbeidsgiver.felles.rapidsrivers.toPretty
import no.nav.helsearbeidsgiver.felles.toFeilMessage
import no.nav.helsearbeidsgiver.utils.log.logger
import no.nav.helsearbeidsgiver.utils.log.sikkerLogger
import no.nav.helsearbeidsgiver.utils.pipe.orDefault

abstract class CompositeEventListener(open val redisStore: IRedisStore) : River.PacketListener {

private val logger = logger()
private val sikkerLogger = sikkerLogger()

abstract val event: EventName
private lateinit var dataKanal: StatefullDataKanal

Expand All @@ -43,7 +47,7 @@ abstract class CompositeEventListener(open val redisStore: IRedisStore) : River.
// vi trenger også clientID for correlation
val transactionId = message[Key.UUID.str].asText()
if (isFailMelding(message)) { // Returnerer INPROGRESS eller TERMINATE
sikkerLogger().error("Feilmelding er\n${message.toPretty()}")
sikkerLogger.error("Feilmelding er\n${message.toPretty()}")
return onError(message.toFeilMessage())
}

Expand All @@ -53,6 +57,10 @@ abstract class CompositeEventListener(open val redisStore: IRedisStore) : River.
return when {
value.isNullOrEmpty() -> {
if (!isEventMelding(message)) {
"Servicen er inaktiv for gitt event. Mest sannsynlig skyldes dette timeout av Redis-verdier.".also {
logger.error(it)
sikkerLogger.error(it)
}
Transaction.NOT_ACTIVE
} else {
val clientId = message[Key.CLIENT_ID.str]
Expand Down