diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/App.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/App.kt index 88b4e83d..f2bc6262 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/App.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/App.kt @@ -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) + } } } diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSDocument.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSDocument.kt index 4448f7aa..1cc91ab0 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSDocument.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbMSDocument.kt @@ -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 @@ -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") } \ No newline at end of file diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt index a61db09f..1b0b3dbe 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/processing/Processor.kt @@ -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 @@ -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 }