-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dev/fjern-ubrukte-keys
- Loading branch information
Showing
39 changed files
with
515 additions
and
266 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
bro-spinn/src/main/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/brospinn/Jackson.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package no.nav.helsearbeidsgiver.inntektsmelding.brospinn | ||
|
||
import no.nav.helsearbeidsgiver.felles.json.jacksonOm | ||
import no.nav.inntektsmeldingkontrakt.Inntektsmelding | ||
|
||
object Jackson { | ||
fun fromJson(json: String): Inntektsmelding = | ||
jacksonOm.readValue(json, Inntektsmelding::class.java) | ||
|
||
fun toJson(im: Inntektsmelding): String = | ||
jacksonOm.writeValueAsString(im) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kafkaPool: nav-dev | ||
azure: | ||
enabled: true | ||
database: im-error-recovery | ||
envFrom: | ||
- type: secret | ||
name: google-sql-im-feil-behandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kafkaPool: nav-prod | ||
azure: | ||
enabled: true | ||
database: im-error-recovery | ||
envFrom: | ||
- type: secret | ||
name: google-sql-im-feil-behandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
val exposedVersion: String by project | ||
val flywayVersion: String by project | ||
val hikariVersion: String by project | ||
val postgresqlVersion: String by project | ||
val testcontainersPostgresqlVersion: String by project | ||
|
||
dependencies { | ||
implementation("com.zaxxer:HikariCP:$hikariVersion") | ||
implementation("org.flywaydb:flyway-core:$flywayVersion") | ||
implementation("org.flywaydb:flyway-database-postgresql:$flywayVersion") | ||
|
||
runtimeOnly("org.postgresql:postgresql:$postgresqlVersion") | ||
|
||
testImplementation("org.testcontainers:postgresql:$testcontainersPostgresqlVersion") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Dependency versions | ||
flywayVersion=10.1.0 | ||
hikariVersion=5.1.0 | ||
postgresqlVersion=42.7.0 | ||
testcontainersPostgresqlVersion=1.19.3 |
44 changes: 44 additions & 0 deletions
44
feil-behandler/src/main/kotlin/no/nav/helsearbeidsgiver/inntektsmelding/feilbehandler/App.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package no.nav.helsearbeidsgiver.inntektsmelding.feilbehandler | ||
|
||
import com.zaxxer.hikari.HikariConfig | ||
import no.nav.helse.rapids_rivers.RapidApplication | ||
import no.nav.helse.rapids_rivers.RapidsConnection | ||
import no.nav.helsearbeidsgiver.inntektsmelding.feilbehandler.config.Database | ||
import no.nav.helsearbeidsgiver.inntektsmelding.feilbehandler.config.DatabaseConfig | ||
import no.nav.helsearbeidsgiver.inntektsmelding.feilbehandler.config.mapHikariConfig | ||
import no.nav.helsearbeidsgiver.inntektsmelding.feilbehandler.river.FeilLytter | ||
import no.nav.helsearbeidsgiver.utils.log.logger | ||
import no.nav.helsearbeidsgiver.utils.log.sikkerLogger | ||
|
||
private val logger = "helsearbeidsgiver-im-feil-behandler".logger() | ||
private val sikkerLogger = sikkerLogger() | ||
|
||
fun main() { | ||
buildApp(mapHikariConfig(DatabaseConfig()), System.getenv()).start() | ||
} | ||
|
||
fun buildApp(config: HikariConfig, env: Map<String, String>): RapidsConnection { | ||
val database = Database(config) | ||
sikkerLogger.info("Bruker database url: ${config.jdbcUrl}") | ||
logger.info("Migrering starter...") | ||
database.migrate() | ||
logger.info("Migrering ferdig.") | ||
return RapidApplication | ||
.create(env) | ||
.createFeilLytter(database) | ||
} | ||
|
||
fun RapidsConnection.createFeilLytter(database: Database): RapidsConnection = | ||
also { | ||
registerDbLifecycle(database) | ||
FeilLytter(it) | ||
} | ||
|
||
private fun RapidsConnection.registerDbLifecycle(db: Database) { | ||
register(object : RapidsConnection.StatusListener { | ||
override fun onShutdown(rapidsConnection: RapidsConnection) { | ||
logger.info("Mottatt stoppsignal, lukker databasetilkobling") | ||
db.dataSource.close() | ||
} | ||
}) | ||
} |
Oops, something went wrong.