Skip to content

Commit

Permalink
Fjærnet context receivers fra bekreftelse-min-side-oppgaver
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsmsa committed Sep 27, 2024
1 parent 1652948 commit 4be9969
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
8 changes: 0 additions & 8 deletions apps/bekreftelse-min-side-oppgaver/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,10 @@ dependencies {
testImplementation(project(":test:test-data-lib"))
}

//enable context receiver
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
freeCompilerArgs.add("-Xcontext-receivers")
}
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()
}


jib {
from.image = "$baseImage:$jvmMajorVersion"
to.image = "${image ?: project.name}:${project.version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import java.util.*

typealias InternalStateStore = KeyValueStore<UUID, InternTilstand>

context(ProcessorContext<*, *>)
fun StateStoreName.getStateStore(): InternalStateStore = getStateStore(value)
fun ProcessorContext<*, *>.getStateStore(stateStoreName: StateStoreName ): InternalStateStore = getStateStore(stateStoreName.value)

private val logger = LoggerFactory.getLogger("bekreftelse.varsler.topology")

Expand All @@ -36,7 +35,7 @@ fun StreamsBuilder.applicationTopology(
stream<Long, Periode>(kafkaTopics.periodeTopic)
.filter { _, periode -> periode.avsluttet == null }
.genericProcess<Long, Periode, Long, Unit>("lagre_periode_data", stateStoreName.value) { (_, periode) ->
val stateStore = stateStoreName.getStateStore()
val stateStore = getStateStore(stateStoreName)
val gjeldeneTilstand = stateStore[periode.id]
val nyTilstand = genererTilstand(gjeldeneTilstand, periode)
if (nyTilstand != gjeldeneTilstand) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import no.nav.paw.arbeidssokerregisteret.api.v1.Periode
import java.util.*


context(KafkaKeyContext)
fun periode(
fun KafkaKeyContext.periode(
periodeId: UUID = UUID.randomUUID(),
identitetsnummer: String = "12345678901",
startetMetadata: Metadata = metadata(),
Expand Down

0 comments on commit 4be9969

Please sign in to comment.