Skip to content

Commit

Permalink
wip: logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitenok committed Oct 27, 2023
1 parent 64ffe37 commit b271dca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import kotlin.system.exitProcess
@Component
class AktivitetskravKafkaListener @Autowired constructor(
private val aktivitetskravService: AktivitetskravService,
private val metric: Metric
private val metric: Metric,
) {
val log = logger()

Expand All @@ -33,10 +33,11 @@ class AktivitetskravKafkaListener @Autowired constructor(
@KafkaListener(topics = [aktivitetskravVarselTopic, aktivitetskravVurderingTopic])
fun listenToTopic(
record: ConsumerRecord<String, String>,
ack: Acknowledgment
ack: Acknowledgment,
) {
val topic = record.topic()
metric.countRecordReceived()
log.info("[EsyfovarselAK] Received record from topic $topic")
try {
when (topic) {
aktivitetskravVurderingTopic ->
Expand All @@ -49,7 +50,7 @@ class AktivitetskravKafkaListener @Autowired constructor(

ack.acknowledge()
} catch (e: RuntimeException) {
log.error("Error during record processing from topic $topic. Shutting down application ...", e)
log.error("[EsyfovarselAK] Error during record processing from topic $topic. Shutting down application ...", e)
metric.countKafkaErrorShutdown()
exitProcess(1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AktivitetskravService @Autowired constructor(
private val log = logger()

fun processAktivitetskravVurdering(kafkaAktivitetskravVurdering: KAktivitetskravVurdering) {
log.info("[EsyfovarselAK] processAktivitetskravVurdering record")
aktivitetskravDAO.storeAktivitetkravVurdering(kafkaAktivitetskravVurdering)
val vurdering = kafkaAktivitetskravVurdering.toAktivitetskravVurdering()
val esyfovarselHendelse =
Expand Down

0 comments on commit b271dca

Please sign in to comment.