Skip to content

Commit

Permalink
Merge branch 'main' into produsent-api_nySak_valider-maxLength-og-non…
Browse files Browse the repository at this point in the history
…Identifying
  • Loading branch information
kenglxn authored Dec 20, 2024
2 parents bf105cf + ef69602 commit 799e09d
Show file tree
Hide file tree
Showing 58 changed files with 1,665 additions and 498 deletions.
6 changes: 3 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ List alle consumer groups på fager.notifikasjon topic:

List offsets for en consumer group (fra listen over consumer groups):
```
./kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --command-config $KAFKA_CONFIG/kafka.properties --group bruker-model-builder --describe
.kafka-cli/bin/kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --command-config $KAFKA_CONFIG/kafka.properties --group bruker-model-builder --describe
```

Dersom man skal endre en offset på en partisjon må consumer group være inaktiv. Dette gjøres enklest ved å skalere ned deployment til 0:
Expand All @@ -103,13 +103,13 @@ kubectl scale --replicas=1 deployment/notifikasjon-dataprodukt

Hopp over en offset på en gitt partisjon for en consumer group:
```
./kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --command-config $KAFKA_CONFIG/kafka.properties --group bruker-model-builder --topic fager.notifikasjon:12 --reset-offsets --shift-by 1 --execute
.kafka-cli/bin/kafka-consumer-groups.sh --bootstrap-server $KAFKA_BROKERS --command-config $KAFKA_CONFIG/kafka.properties --group bruker-model-builder --topic fager.notifikasjon:12 --reset-offsets --shift-by 1 --execute
```


Les topic for en gitt partisjon fra et gitt offset:
```
.kafka-cli/bin/./kafka-console-consumer.sh --bootstrap-server $KAFKA_BROKERS --consumer.config $KAFKA_CONFIG/kafka.properties --topic fager.notifikasjon --formatter kafka.tools.DefaultMessageFormatter --property print.value=true --property print.offset=true --partition 12 --offset 124
.kafka-cli/bin/kafka-console-consumer.sh --bootstrap-server $KAFKA_BROKERS --consumer.config $KAFKA_CONFIG/kafka.properties --topic fager.notifikasjon --formatter kafka.tools.DefaultMessageFormatter --property print.value=true --property print.offset=true --partition 12 --offset 124
```

Describe topic:
Expand Down
2 changes: 1 addition & 1 deletion app/nais/dev-gcp-bruker-api-writer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
kind: Project
role: roles/cloudsql.client
envFrom:
- secret: google-sql-notifikasjon-bruker-api-bruker-model-bruker-a319af7c
- secret: google-sql-notifikasjon-bruker-api
env:
- name: CLOUD_SQL_INSTANCE
value: fager-dev-24f2:europe-north1:notifikasjon-bruker-api
Expand Down
2 changes: 1 addition & 1 deletion app/nais/dev-gcp-produsent-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
namespace: team-esyfo
cluster: dev-gcp

- application: permitteringsmelding-notifikasjon
- application: permitteringsskjema-api
namespace: permittering-og-nedbemanning
cluster: dev-gcp

Expand Down
2 changes: 1 addition & 1 deletion app/nais/prod-gcp-bruker-api-writer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
kind: Project
role: roles/cloudsql.client
envFrom:
- secret: google-sql-notifikasjon-bruker-api-bruker-model-bruker-a319af7c
- secret: google-sql-notifikasjon-bruker-api

---
# https://nav-it.slack.com/archives/C5KUST8N6/p1680085706741319
Expand Down
2 changes: 1 addition & 1 deletion app/nais/prod-gcp-produsent-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
namespace: team-tiltak
cluster: prod-gcp

- application: permitteringsmelding-notifikasjon
- application: permitteringsskjema-api
namespace: permittering-og-nedbemanning
cluster: prod-gcp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@ class BrukerRepositoryImpl(
}.getOrNull(0)

override suspend fun oppdaterModellEtterHendelse(hendelse: Hendelse, metadata: HendelseMetadata) {
if (hendelse is HendelseModel.AggregatOpprettet) {
registrerKoblingForCascadeDelete(hendelse)
}
if (erHardDeleted(hendelse.aggregateId)) {
log.info("skipping harddeleted event {}", hendelse)
return
Expand All @@ -703,14 +706,7 @@ class BrukerRepositoryImpl(
is OppgaveUtført -> oppdaterModellEtterOppgaveUtført(hendelse, metadata)
is OppgaveUtgått -> oppdaterModellEtterOppgaveUtgått(hendelse)
is SoftDelete -> oppdaterModellEtterDelete(hendelse.aggregateId, hendelse.grupperingsid, hendelse.merkelapp)
is HardDelete -> oppdaterModellEtterDelete(
hendelse.aggregateId,
hendelse.grupperingsid,
hendelse.merkelapp
) { tx ->
registrerHardDelete(tx, hendelse)
}

is HardDelete -> oppdaterModellEtterDelete(hendelse.aggregateId,hendelse.grupperingsid,hendelse.merkelapp)
is EksterntVarselFeilet -> Unit
is EksterntVarselVellykket -> Unit
is EksterntVarselKansellert -> Unit
Expand Down Expand Up @@ -831,8 +827,7 @@ class BrukerRepositoryImpl(
private suspend fun oppdaterModellEtterDelete(
aggregateId: UUID,
grupperingsid: String?,
merkelapp: String?,
callback: (tx: Transaction) -> Unit = {}
merkelapp: String?
) {
database.transaction({
throw RuntimeException("Delete", it)
Expand All @@ -856,7 +851,7 @@ class BrukerRepositoryImpl(
uuid(aggregateId)
}

callback(this)
registrerDelete(this, aggregateId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import no.nav.arbeidsgiver.notifikasjon.infrastruktur.kafka.NærmesteLederKafkaL
object BrukerWriter {
val databaseConfig = Database.config(
"bruker_model",
envPrefix = "DB_BRUKER_API_KAFKA_USER",
jdbcOpts = mapOf(
"socketFactory" to "com.google.cloud.sql.postgres.SocketFactory",
"cloudSqlInstance" to System.getenv("CLOUD_SQL_INSTANCE")!!
Expand Down
Loading

0 comments on commit 799e09d

Please sign in to comment.