Skip to content

Commit

Permalink
Add SLF4J logging to DoedsmeldingService #deploy-tps-messaging-service
Browse files Browse the repository at this point in the history
Added a logging function to track sent statuses in DoedsmeldingService. With the help of @slf4j annotation, all sent statuses for each environment are logged for better tracking and debugging. This allows a clearer understanding of the state of death notifications. Additionally, a refactor has been made in the SkdMeldingsheader class to simplify the construction of message header strings.
  • Loading branch information
krharum committed Mar 7, 2024
1 parent 40c45a9 commit 9a8831f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,15 @@ public String appendHeader(String skdMelding) {
var transType = extractTranstype(skdMelding);
var tildelingsKode = extractTildelingskode(skdMelding);

var headerSkdMelding = new StringBuilder()
return new StringBuilder()
.append(MQ_HANDLE)
.append(KODE_SYSTEM)
.append(KJORE_NUMMER)
.append(aarsakskode)
.append(transType)
.append(tildelingsKode)
.append(SKD_REFERANSE);

return new StringBuilder(skdMelding)
.reverse()
.append(headerSkdMelding.reverse())
.reverse()
.append(SKD_REFERANSE)
.append(skdMelding)
.toString();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.testnav.apps.tpsmessagingservice.service;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import no.nav.testnav.apps.tpsmessagingservice.consumer.TestmiljoerServiceConsumer;
import no.nav.testnav.apps.tpsmessagingservice.dto.endringsmeldinger.SkdMeldingsheader;
import no.nav.testnav.apps.tpsmessagingservice.service.skd.DoedsmeldingAnnulleringBuilderService;
Expand All @@ -15,6 +16,7 @@
import java.util.List;
import java.util.Map;

@Slf4j
@Service
@RequiredArgsConstructor
public class DoedsmeldingService {
Expand Down Expand Up @@ -62,6 +64,8 @@ public DoedsmeldingResponse annulerDoedsmelding(PersonDTO person, List<String> m

private void prepareStatus(Map<String, String> sentStatus) {

sentStatus.forEach((env, status) -> log.info("Doedsmelding i miljø {} status {} ", env, status));

sentStatus.replaceAll((env, status) -> status.matches("^00.*") ? "OK" : ResponseStatus.extract(status));
}
}

0 comments on commit 9a8831f

Please sign in to comment.