Skip to content

Commit

Permalink
Logger mer av tenkt flyt
Browse files Browse the repository at this point in the history
  • Loading branch information
thburnett committed Oct 12, 2023
1 parent 8247ff5 commit 2e84c82
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ebms-provider/src/main/kotlin/no/nav/emottak/ebms/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ fun Application.myApplicationModule() {
is EbmsAcknowledgment -> message.process()
is EbMSMessageError -> message.process()
is EbMSPayloadMessage -> {
val response = message.process()
//sendResponse(response)
when (val response = message.process()) {
is EbmsAcknowledgment -> response.toEbmsDokument().sendResponse(response.messageHeader)
is EbMSMessageError -> response.toEbmsDokument().sendErrorResponse(response.messageHeader)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package no.nav.emottak.ebms.model

import no.nav.emottak.ebms.xml.xmlMarshaller
import no.nav.emottak.util.marker
import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.MessageHeader
import org.slf4j.LoggerFactory
import org.w3c.dom.Document
import org.xmlsoap.schemas.soap.envelope.Envelope
Expand All @@ -43,4 +44,11 @@ fun EbMSDocument.buildEbmMessage(): EbMSBaseMessage {
log.info(header.messageHeader().marker(), "Mottak melding av type payload")
EbMSPayloadMessage(this.dokument,header.messageHeader(),header.ackRequested(),this.attachments, LocalDateTime.now())
}
}

fun EbMSDocument.sendResponse(messageHeader: MessageHeader) {
log.info(messageHeader.marker(), "TODO return response message")
}
fun EbMSDocument.sendErrorResponse(messageHeader: MessageHeader) {
log.error(messageHeader.marker(), "TODO return response message")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package no.nav.emottak.ebms.processing

import no.nav.emottak.Event
import no.nav.emottak.ebms.model.EbMSBaseMessage
import no.nav.emottak.ebms.model.EbMSPayloadMessage
import no.nav.emottak.util.marker
import org.slf4j.LoggerFactory

Expand Down Expand Up @@ -34,7 +33,11 @@ abstract class Processor(open val ebMSMessage: EbMSBaseMessage) {

fun persisterHendelse(event: Event): Boolean {
// Vi vil se på det ebMSMessage.addHendelse(event)
log.info(this.ebMSMessage.messageHeader.marker(), "$event")
when (event.eventStatus) {
Event.Status.STARTED -> log.info(this.ebMSMessage.messageHeader.marker(), "$event")
Event.Status.OK -> log.info(this.ebMSMessage.messageHeader.marker(), "$event")
Event.Status.FAILED -> log.error(this.ebMSMessage.messageHeader.marker(), "$event")
}
return true; // TODO publiser hendelse
}

Expand Down

0 comments on commit 2e84c82

Please sign in to comment.