-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move domain-logic for createOrUpdate from kafka-consumer to service
- Loading branch information
1 parent
e71296c
commit 985e859
Showing
16 changed files
with
322 additions
and
487 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
29 changes: 29 additions & 0 deletions
29
...in/kotlin/no/nav/syfo/personoppgavehendelse/kafka/PersonoppgavehendelseConsumerService.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,29 @@ | ||
package no.nav.syfo.personoppgavehendelse.kafka | ||
|
||
import no.nav.syfo.kafka.KafkaConsumerService | ||
import no.nav.syfo.personstatus.PersonoversiktStatusService | ||
import org.apache.kafka.clients.consumer.KafkaConsumer | ||
import org.slf4j.LoggerFactory | ||
import java.time.Duration | ||
|
||
class PersonoppgavehendelseConsumerService( | ||
private val personoversiktStatusService: PersonoversiktStatusService, | ||
) : KafkaConsumerService<KPersonoppgavehendelse> { | ||
override val pollDurationInMillis: Long = 100 | ||
|
||
override fun pollAndProcessRecords(kafkaConsumer: KafkaConsumer<String, KPersonoppgavehendelse>) { | ||
val records = kafkaConsumer.poll(Duration.ofMillis(pollDurationInMillis)) | ||
|
||
if (records.count() > 0) { | ||
log.info("TRACE: Received ${records.count()} records") | ||
personoversiktStatusService.createOrUpdatePersonoversiktStatuser( | ||
personoppgavehendelser = records.map { it.value() } | ||
) | ||
kafkaConsumer.commitSync() | ||
} | ||
} | ||
|
||
companion object { | ||
private val log = LoggerFactory.getLogger(PersonoppgavehendelseConsumerService::class.java) | ||
} | ||
} |
155 changes: 0 additions & 155 deletions
155
src/main/kotlin/no/nav/syfo/personoppgavehendelse/kafka/PersonoppgavehendelseService.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.