Repository navigation
feat(links): publish account link events to kafka via outbox - #186
Open
TheMeinerLP wants to merge 12 commits into
Open
TheMeinerLP wants to merge 12 commits into
TheMeinerLP wants to merge 12 commits into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Otis publishes account link changes as events to Kafka through a transactional outbox. Stacked on #184 (
feat/account-links).outbox_eventrow in the same transaction as the change, through the existingLinkTransactionshelper. The covered changes are redeem, setting an unverified link, and unlink.net.onelitefeather.otis.account.linked/.unlinked.source:/otis.id: the outbox row id.subject: the player uuid.datacarries playerUuid, provider, externalId (null for unverified links), verified and occurredAt. It never contains codes or tokens.otis.account-links: Kafka key = player uuid, so events per player stay in order.NewTopicbeans: 3 partitions, replication factor 3.auto.create.topics.enable=falseand no Strimzi topic operator.@Scheduledevery 2 s.SKIP LOCKEDis not available on H2, and MariaDB rejects the self-referencingUPDATE … IN (SELECT …)(error 1093).created_at, and a run stops at the first failure. Delivery is at-least-once, so consumers deduplicate by eventid.KAFKA_ENABLED(defaultfalse). When it is off, no Kafka beans start, no outbox rows are written, and the Kafka health indicator stays off.traceparentheaders come frommicronaut-tracing-opentelemetry-kafka.otis.outbox.pendingis on/prometheusand answers "are link events stuck?".Deployment
KAFKA_ENABLEDstaysfalse, so nothing changes).KAFKA_ENABLED=true, bootstrapfeather-kafka-kafka-bootstrap.kafka.svc:9092; the service exists).Compatibility and migration (no data loss)
outbox_eventis additive only.traceparent, and all rows were marked published.java-clientandvelocity-pluginare unchanged.Known limitations
POST /otis/deleteremoves links by DB cascade withoutunlinkedevents. This is documented in the spec and design.Test plan
./gradlew clean build: 355 tests, 0 failures, 1 skipped (pre-existing disabledOtisTest)run()with a manual clock and a fake publisher (no sleeps); two-replica claim test on H2; rollback test for the outbox; gauge/span/WARN testshttps://claude.ai/code/session_012BmpdMdQ5wwagagQvfcq8S