-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3232 from navikt/maam-topics
kontroller mr-api topic consumer consumers fra maam
- Loading branch information
Showing
9 changed files
with
120 additions
and
86 deletions.
There are no files selected for viewing
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
74 changes: 74 additions & 0 deletions
74
mulighetsrommet-api/src/main/kotlin/no/nav/mulighetsrommet/api/routes/internal/MaamRoutes.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,74 @@ | ||
package no.nav.mulighetsrommet.api.routes.internal | ||
|
||
import io.ktor.http.* | ||
import io.ktor.server.application.* | ||
import io.ktor.server.request.* | ||
import io.ktor.server.response.* | ||
import io.ktor.server.routing.* | ||
import kotlinx.serialization.Serializable | ||
import no.nav.mulighetsrommet.api.tasks.GenerateValidationReport | ||
import no.nav.mulighetsrommet.api.tasks.InitialLoadTiltaksgjennomforinger | ||
import no.nav.mulighetsrommet.api.tasks.InitialLoadTiltaksgjennomforingerInput | ||
import no.nav.mulighetsrommet.api.tasks.SynchronizeNavAnsatte | ||
import no.nav.mulighetsrommet.domain.constants.ArenaMigrering | ||
import no.nav.mulighetsrommet.domain.serializers.UUIDSerializer | ||
import no.nav.mulighetsrommet.kafka.KafkaConsumerOrchestrator | ||
import no.nav.mulighetsrommet.kafka.Topic | ||
import org.koin.ktor.ext.inject | ||
import java.util.* | ||
|
||
fun Route.maamRoutes() { | ||
route("/api/internal/maam") { | ||
route("/tasks") { | ||
val generateValidationReport: GenerateValidationReport by inject() | ||
val initialLoadTiltaksgjennomforinger: InitialLoadTiltaksgjennomforinger by inject() | ||
val synchronizeNavAnsatte: SynchronizeNavAnsatte by inject() | ||
|
||
post("generate-validation-report") { | ||
val taskId = generateValidationReport.schedule() | ||
|
||
call.respond(HttpStatusCode.Accepted, ScheduleTaskResponse(id = taskId)) | ||
} | ||
|
||
post("initial-load-tiltaksgjennomforinger") { | ||
val input = InitialLoadTiltaksgjennomforingerInput(opphav = null) | ||
val taskId = initialLoadTiltaksgjennomforinger.schedule(input) | ||
|
||
call.respond(HttpStatusCode.Accepted, ScheduleTaskResponse(id = taskId)) | ||
} | ||
|
||
post("initial-load-mulighetsrommet-tiltaksgjennomforinger") { | ||
val input = InitialLoadTiltaksgjennomforingerInput(opphav = ArenaMigrering.Opphav.MR_ADMIN_FLATE) | ||
val taskId = initialLoadTiltaksgjennomforinger.schedule(input) | ||
|
||
call.respond(HttpStatusCode.Accepted, ScheduleTaskResponse(id = taskId)) | ||
} | ||
|
||
post("sync-navansatte") { | ||
val taskId = synchronizeNavAnsatte.schedule() | ||
call.respond(HttpStatusCode.Accepted, ScheduleTaskResponse(id = taskId)) | ||
} | ||
} | ||
|
||
route("/topics") { | ||
val kafka: KafkaConsumerOrchestrator by inject() | ||
|
||
get { | ||
val topics = kafka.getTopics() | ||
call.respond(topics) | ||
} | ||
|
||
put { | ||
val topics = call.receive<List<Topic>>() | ||
kafka.updateRunningTopics(topics) | ||
call.respond(HttpStatusCode.OK) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Serializable | ||
data class ScheduleTaskResponse( | ||
@Serializable(with = UUIDSerializer::class) | ||
val id: UUID, | ||
) |
54 changes: 0 additions & 54 deletions
54
mulighetsrommet-api/src/main/kotlin/no/nav/mulighetsrommet/api/routes/internal/Tasks.kt
This file was deleted.
Oops, something went wrong.