Skip to content

Commit

Permalink
Merge pull request #4693 from navikt/feature/ktor
Browse files Browse the repository at this point in the history
feature/ktor
  • Loading branch information
sondrele authored Nov 28, 2024
2 parents 0b4e508 + 8e5afc5 commit 2b4e09d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,16 @@ fun Application.configure(config: AppConfig) {

val scheduler: Scheduler by inject()

environment.monitor.subscribe(ApplicationStarted) {
monitor.subscribe(ApplicationStarted) {
kafka.enableFailedRecordProcessor()

scheduler.start()
}

environment.monitor.subscribe(ApplicationStopPreparing) {
monitor.subscribe(ApplicationStopPreparing) {
kafka.disableFailedRecordProcessor()
kafka.stopPollingTopicChanges()

scheduler.stop()

db.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ private fun tasks(config: TaskConfig) = module {
generateRefusjonskrav.task,
)
.serializer(DbSchedulerKotlinSerializer())
.registerShutdownHook()
.build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fun Application.configure(config: AppConfig) {
}
}

environment.monitor.subscribe(ApplicationStarted) {
monitor.subscribe(ApplicationStarted) {
if (config.enableFailedRecordProcessor) {
kafka.enableFailedRecordProcessor()
}
Expand All @@ -66,12 +66,10 @@ fun Application.configure(config: AppConfig) {
replayEvents.schedule(Instant.now().plusSeconds(60))
}

environment.monitor.subscribe(ApplicationStopPreparing) {
monitor.subscribe(ApplicationStopPreparing) {
kafka.disableFailedRecordProcessor()
kafka.stopPollingTopicChanges()

scheduler.stop()

db.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private fun tasks(tasks: TaskConfig) = module {
.addSchedulerListener(SlackNotifierSchedulerListener(get()))
.addSchedulerListener(OpenTelemetrySchedulerListener())
.startTasks(retryFailedEvents.task, notifyFailedEvents.task)
.registerShutdownHook()
.build()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ fun Application.configure(config: AppConfig) {
tiltakshistorikkRoutes(deltakerRepository, tiltakshistorikkService)
}

environment.monitor.subscribe(ApplicationStarted) {
monitor.subscribe(ApplicationStarted) {
kafka.enableFailedRecordProcessor()
}

environment.monitor.subscribe(ApplicationStopPreparing) {
monitor.subscribe(ApplicationStopPreparing) {
kafka.disableFailedRecordProcessor()
kafka.stopPollingTopicChanges()

Expand Down

0 comments on commit 2b4e09d

Please sign in to comment.