-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publiser meldinger på Kafka sammen med nøkkel (i rivers) #824
Conversation
@@ -31,6 +32,9 @@ internal class OpenRiver( | |||
.toJson() | |||
.parseJson() | |||
.haandterMelding() | |||
?.also { context.publish(null, it) } | |||
?.also { (kafkaKey, melding) -> | |||
// TODO gjør key non-nullable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO skal tas i kommende PR.
runCatching { | ||
it.haandter(jsonMap) | ||
innkommende.skrivNoekkel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeg ble litt forvirret av skriv-delen av navnet til denne metoden. Det ser ut den spytter ut nøkkelen fra den innkommende meldingen? Det kan være noe jeg misser her, men for meg minner det mer om lesing/getting/mapping enn skriving? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeg kom ikke på noe navn som jeg synes var en fulltreffer, men poenget med funksjonen er at den definerer nøkkelen som blir brukt når man skriver en melding til Kafka. Så den bruker den innkommende meldingen, som er all "state" de fleste av appene har, til å finne hvilken nøkkel den skal bruke på den utgående.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skjønner, ikke så lett den der. Hva med bestemNoekkel()
eller avgjoerNoekkel()
eller definerNoekkel()
? Evt. smelle på "utgående" i tillegg? bestemUtgaaendeNoekkel()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeg liker bestemNoekkel
! Går for den. Hvis det blir mer forvirring så kan vi smelle på "utgående" senere.
Testet OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗝️ 🔑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De fleste har naturlige nøkler tilgjengelige, mens noen rivers er brukt av stateful servicer, som trenger mer kontroll på hvilke nøkler som brukes. Disse får allerede tilsendt nøkkel i dag, i feltet
Key.SVAR_KAFKA_KEY
.