From 34f3e5b40d9e8349379923f71c048fcb0309d8b3 Mon Sep 17 00:00:00 2001 From: Tor-Christian Tangenes Date: Tue, 24 Oct 2023 10:31:10 +0200 Subject: [PATCH] Replay kafka topic with new dataformat --- .../kotlin/no/nav/syfo/kafka/config/AivenKafkaConfig.kt | 2 +- .../nav/syfo/kafka/consumer/domain/KAktivitetskravVarsel.kt | 6 ++++-- .../syfo/kafka/consumer/domain/KAktivitetskravVurdering.kt | 6 ++++-- .../no/nav/syfo/service/domain/AktivitetskravVarsel.kt | 3 ++- .../no/nav/syfo/service/domain/AktivitetskravVurdering.kt | 3 ++- .../db/migration/V4__Delete_aktivitetskrav_db_data.sql | 2 ++ .../resources/db/migration/V5__Add_new_uuid_columns.sql | 5 +++++ 7 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 src/main/resources/db/migration/V4__Delete_aktivitetskrav_db_data.sql create mode 100644 src/main/resources/db/migration/V5__Add_new_uuid_columns.sql diff --git a/src/main/kotlin/no/nav/syfo/kafka/config/AivenKafkaConfig.kt b/src/main/kotlin/no/nav/syfo/kafka/config/AivenKafkaConfig.kt index e7beac2..b7edd92 100644 --- a/src/main/kotlin/no/nav/syfo/kafka/config/AivenKafkaConfig.kt +++ b/src/main/kotlin/no/nav/syfo/kafka/config/AivenKafkaConfig.kt @@ -48,7 +48,7 @@ class AivenKafkaConfig( aivenKafkaErrorHandler: AivenKafkaErrorHandler ): ConcurrentKafkaListenerContainerFactory { val config = mapOf( - ConsumerConfig.GROUP_ID_CONFIG to "aktivitetskrav-backend-group-v1", + ConsumerConfig.GROUP_ID_CONFIG to "aktivitetskrav-backend-group-v2", ConsumerConfig.AUTO_OFFSET_RESET_CONFIG to kafkaAutoOffsetReset, ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java, ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java, diff --git a/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVarsel.kt b/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVarsel.kt index 552eb54..779a7f2 100644 --- a/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVarsel.kt +++ b/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVarsel.kt @@ -29,7 +29,8 @@ data class KAktivitetskravVarsel( val createdAt: OffsetDateTime, val journalpostId: String, val svarfrist: LocalDate, - val document: List + val document: List, + val internUuid: UUID ) : Serializable fun KAktivitetskravVarsel.toAktivitetskravVarsel() = @@ -40,5 +41,6 @@ fun KAktivitetskravVarsel.toAktivitetskravVarsel() = createdAt = this.createdAt, journalpostId = this.journalpostId, svarfrist = this.svarfrist, - document = this.document + document = this.document, + internUuid = this.internUuid ) diff --git a/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVurdering.kt b/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVurdering.kt index 8cea05e..2941dfa 100644 --- a/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVurdering.kt +++ b/src/main/kotlin/no/nav/syfo/kafka/consumer/domain/KAktivitetskravVurdering.kt @@ -15,7 +15,8 @@ data class KAktivitetskravVurdering( val stoppunktAt: LocalDate, val updatedBy: String?, val sistVurdert: OffsetDateTime?, - val frist: LocalDate? + val frist: LocalDate?, + val internUuid: UUID ) fun KAktivitetskravVurdering.toAktivitetskravVurdering() = @@ -29,5 +30,6 @@ fun KAktivitetskravVurdering.toAktivitetskravVurdering() = stoppunktAt = this.stoppunktAt, updatedBy = this.updatedBy, sistVurdert = this.sistVurdert, - frist = this.frist + frist = this.frist, + internUuid = this.internUuid ) diff --git a/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVarsel.kt b/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVarsel.kt index e592baf..d1b2367 100644 --- a/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVarsel.kt +++ b/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVarsel.kt @@ -12,5 +12,6 @@ data class AktivitetskravVarsel( val createdAt: OffsetDateTime, val journalpostId: String, val svarfrist: LocalDate, - val document: List + val document: List, + val internUuid: UUID ) diff --git a/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVurdering.kt b/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVurdering.kt index 67d1ea1..3eaf48b 100644 --- a/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVurdering.kt +++ b/src/main/kotlin/no/nav/syfo/service/domain/AktivitetskravVurdering.kt @@ -14,5 +14,6 @@ data class AktivitetskravVurdering( val stoppunktAt: LocalDate, val updatedBy: String?, val sistVurdert: OffsetDateTime?, - val frist: LocalDate? + val frist: LocalDate?, + val internUuid: UUID ) diff --git a/src/main/resources/db/migration/V4__Delete_aktivitetskrav_db_data.sql b/src/main/resources/db/migration/V4__Delete_aktivitetskrav_db_data.sql new file mode 100644 index 0000000..a54279f --- /dev/null +++ b/src/main/resources/db/migration/V4__Delete_aktivitetskrav_db_data.sql @@ -0,0 +1,2 @@ +DELETE FROM AKTIVITETSKRAV_VARSEL; +DELETE FROM AKTIVITETSKRAV_VURDERING; \ No newline at end of file diff --git a/src/main/resources/db/migration/V5__Add_new_uuid_columns.sql b/src/main/resources/db/migration/V5__Add_new_uuid_columns.sql new file mode 100644 index 0000000..b33d37c --- /dev/null +++ b/src/main/resources/db/migration/V5__Add_new_uuid_columns.sql @@ -0,0 +1,5 @@ +ALTER TABLE AKTIVITETSKRAV_VURDERING + ADD COLUMN internal_uuid UUID NOT NULL; + +ALTER TABLE AKTIVITETSKRAV_VARSEL + ADD COLUMN internal_uuid UUID NOT NULL;