generated from navikt/helse-spokelse
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Håkon Arneng Holmstedt <hakon.arneng.holmstedt@nav.no> Co-authored-by: Erik Maximilian Forsman <erik.maximilian.forsman@nav.no> Co-authored-by: Amalie Erdal Mansåker <amalie.erdal.mansaker@nav.no>
- Loading branch information
1 parent
b377246
commit e5f3f03
Showing
8 changed files
with
58 additions
and
50 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
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/no/nav/helse/sporbar/sis/Behandlingstatusmelding.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,27 @@ | ||
package no.nav.helse.sporbar.sis | ||
|
||
import java.time.OffsetDateTime | ||
import java.util.UUID | ||
|
||
data class Behandlingstatusmelding( | ||
val vedtaksperiodeId: UUID, | ||
val behandlingId: UUID, | ||
val tidspunkt: OffsetDateTime, | ||
val status: Behandlingstatustype, | ||
val eksternSøknadId: UUID? = null | ||
) { | ||
enum class Behandlingstatustype { | ||
OPPRETTET, | ||
VENTER_PÅ_ARBEIDSGIVER, | ||
VENTER_PÅ_SAKSBEHANDLER, | ||
FERDIG, | ||
BEHANDLES_UTENFOR_SPEIL | ||
} | ||
|
||
companion object { | ||
fun behandlingOpprettet(vedtaksperiodeId: UUID, behandlingId: UUID, tidspunkt: OffsetDateTime, eksternSøknadId: UUID) = | ||
Behandlingstatusmelding(vedtaksperiodeId, behandlingId, tidspunkt, Behandlingstatustype.OPPRETTET, eksternSøknadId) | ||
fun behandlingstatus(vedtaksperiodeId: UUID, behandlingId: UUID, tidspunkt: OffsetDateTime, status: Behandlingstatustype) = | ||
Behandlingstatusmelding(vedtaksperiodeId, behandlingId, tidspunkt, status, null) | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
src/main/kotlin/no/nav/helse/sporbar/sis/LagBehandlingStatus.kt
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,27 @@ | ||
package no.nav.helse.sporbar.sis | ||
|
||
import com.fasterxml.jackson.databind.SerializationFeature | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import java.util.UUID | ||
import org.apache.kafka.clients.producer.KafkaProducer | ||
import org.apache.kafka.clients.producer.ProducerRecord | ||
import org.slf4j.LoggerFactory | ||
|
||
interface SisPublisher { | ||
fun send(vedtaksperiodeId: UUID, melding: String) | ||
fun send(vedtaksperiodeId: UUID, melding: Behandlingstatusmelding) | ||
} | ||
|
||
class KafkaSisPublisher(private val producer: KafkaProducer<String, String>, private val topicName: String = "tbd.sis"): SisPublisher { | ||
private companion object { | ||
private val mapper = jacksonObjectMapper() | ||
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) | ||
private val sikkerLogg = LoggerFactory.getLogger("tjenestekall") | ||
private val Behandlingstatusmelding.json: String get() = mapper.writeValueAsString(this) | ||
} | ||
|
||
override fun send(vedtaksperiodeId: UUID, melding: String) { | ||
producer.send(ProducerRecord(topicName, vedtaksperiodeId.toString(), melding)) | ||
sikkerLogg.info("Sender $melding") | ||
override fun send(vedtaksperiodeId: UUID, melding: Behandlingstatusmelding) { | ||
val meldingJson = melding.json | ||
producer.send(ProducerRecord(topicName, vedtaksperiodeId.toString(), meldingJson)) | ||
sikkerLogg.info("Sender $meldingJson\nfra $melding") | ||
} | ||
} |
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