Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
f Bean for profilertmeldinger og sender til test-topic i dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Jørgen Tu Sveli committed Aug 31, 2021
1 parent 5310804 commit cdb9c55
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ PubliseringAvEventsService publiseringAvEventsService(
@Qualifier("arbeidssokerRegistrertKafkaProducerAiven")
ArbeidssokerRegistrertProducer arbeidssokerRegistrertProducerAiven,
RegistreringTilstandRepository registreringTilstandRepository,
@Qualifier("arbeidssokerProfilertKafkaProducer")
ArbeidssokerProfilertProducer arbeidssokerProfilertProducer,
@Qualifier("arbeidssokerProfilertKafkaProducerAiven")
ArbeidssokerProfilertProducer arbeidssokerProfilertProducerAiven,
PrometheusMetricsService prometheusMetricsService) {
return new PubliseringAvEventsService(
profileringRepository,
Expand All @@ -285,6 +288,7 @@ PubliseringAvEventsService publiseringAvEventsService(
arbeidssokerRegistrertProducerAiven,
registreringTilstandRepository,
arbeidssokerProfilertProducer,
arbeidssokerProfilertProducerAiven,
prometheusMetricsService);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ ArbeidssokerProfilertKafkaProducer arbeidssokerProfilertKafkaProducer(@Qualifier
@Bean
ArbeidssokerRegistrertKafkaProducer arbeidssokerRegistrertKafkaProducerAiven(@Qualifier("producerAiven") KafkaProducer kafkaProducerAiven) {
return new ArbeidssokerRegistrertKafkaProducer(
kafkaProducerAiven,
"paw.arbeidssoker-registrert-v1");
}

@Bean
ArbeidssokerProfilertKafkaProducer arbeidssokerProfilertKafkaProducerAiven(@Qualifier("producerAiven") KafkaProducer kafkaProducerAiven) {
return new ArbeidssokerProfilertKafkaProducer(
kafkaProducerAiven,
"paw.paw-test-topic");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class PubliseringAvEventsService(
private val arbeidssokerRegistrertProducerAiven: ArbeidssokerRegistrertProducer,
private val registreringTilstandRepository: RegistreringTilstandRepository,
private val arbeidssokerProfilertProducer: ArbeidssokerProfilertProducer,
private val arbeidssokerProfilertProducerAiven: ArbeidssokerProfilertProducer,
private val prometheusMetricsService: PrometheusMetricsService
) {
@Transactional
Expand Down Expand Up @@ -49,21 +50,22 @@ class PubliseringAvEventsService(
ordinaerBrukerRegistrering.opprettetDato
).also {
arbeidssokerRegistrertProducer.publiserArbeidssokerRegistrert(it)
if (System.getenv("APP_ENVIRONMENT_NAME") == "dev") {
try {
LOG.info("Producing message on aiven topic")
arbeidssokerRegistrertProducerAiven.publiserArbeidssokerRegistrert(it)
} catch (e: Exception) {
LOG.warn("Producing message on aiven topic FAILED with error {}", e)
}
}
//arbeidssokerRegistrertProducerAiven.publiserArbeidssokerRegistrert(it)
}

arbeidssokerProfilertProducer.publiserProfilering(
bruker.aktorId,
profilering.innsatsgruppe,
ordinaerBrukerRegistrering.opprettetDato
)

if (System.getenv("APP_ENVIRONMENT_NAME") == "dev") {
arbeidssokerProfilertProducerAiven.publiserProfilering(
bruker.aktorId,
profilering.innsatsgruppe,
ordinaerBrukerRegistrering.opprettetDato
)
}
}

private fun rapporterRegistreringStatusAntallForPublisering() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ class KafkaConfig {
fun arbeidssokerRegistrertKafkaProducerAiven(): ArbeidssokerRegistrertProducer = mockk()

@Bean
fun arbeidssokerProfilertProducer(): ArbeidssokerProfilertProducer = mockk()
fun arbeidssokerProfilertKafkaProducer(): ArbeidssokerProfilertProducer = mockk()

@Bean
fun arbeidssokerProfilertKafkaProducerAiven(): ArbeidssokerProfilertProducer = mockk()
}

0 comments on commit cdb9c55

Please sign in to comment.