-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Flytt JsonMessage-bygging til CommandContextTilstandMediator
CommandContextTilstandMediator er ansvarlig for å putte meldingen på kafka, så det er naturlig at mapping til dette formatet skjer her Co-authored-by: Jakob Havstein Eriksen <[email protected]>
- Loading branch information
Showing
5 changed files
with
77 additions
and
73 deletions.
There are no files selected for viewing
14 changes: 5 additions & 9 deletions
14
spesialist-selve/src/main/kotlin/no/nav/helse/mediator/CommandContextTilstandMediator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
spesialist-selve/src/main/kotlin/no/nav/helse/mediator/KommandokjedeEndretEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package no.nav.helse.mediator | ||
|
||
import java.util.UUID | ||
|
||
sealed class KommandokjedeEndretEvent { | ||
abstract val commandContextId: UUID | ||
abstract val hendelseId: UUID | ||
|
||
abstract val eventName: String | ||
|
||
fun detaljer(): Map<String, Any> = | ||
mapOf( | ||
"commandContextId" to commandContextId, | ||
"meldingId" to hendelseId, | ||
) + ekstraDetaljer() | ||
|
||
protected open fun ekstraDetaljer(): Map<String, Any> = emptyMap() | ||
|
||
class Ferdig( | ||
private val kommandonavn: String, | ||
override val commandContextId: UUID, | ||
override val hendelseId: UUID, | ||
) : KommandokjedeEndretEvent() { | ||
override val eventName: String = "kommandokjede_ferdigstilt" | ||
|
||
override fun ekstraDetaljer(): Map<String, Any> { | ||
return mapOf("command" to kommandonavn) | ||
} | ||
} | ||
|
||
class Suspendert( | ||
private val kommandonavn: String, | ||
override val commandContextId: UUID, | ||
override val hendelseId: UUID, | ||
) : KommandokjedeEndretEvent() { | ||
override val eventName: String = "kommandokjede_suspendert" | ||
|
||
override fun ekstraDetaljer(): Map<String, Any> { | ||
return mapOf("command" to kommandonavn) | ||
} | ||
} | ||
|
||
class Avbrutt( | ||
override val commandContextId: UUID, | ||
override val hendelseId: UUID, | ||
) : KommandokjedeEndretEvent() { | ||
override val eventName: String = "kommandokjede_avbrutt" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters