refactor: name the deliverBatch result type — DeliveryOutcome replaces Pair<OutboxEntry, DeliveryResult>#45
Merged
endrju19 merged 2 commits intoMay 14, 2026
Conversation
…DeliveryOutcome on MessageDeliverer.deliverBatch Public API cleanup: the per-entry batch-delivery report is now a named domain type rather than an anonymous tuple. The result is the same shape (two fields: entry + result), but with named accessors, Java-friendly ergonomics, and room to grow. Why now (pre-release): - Named domain object > anonymous Pair in a public API — accessors (.entry / .result) carry meaning; Pair.first/Pair.second do not - Java consumers: outcome.getEntry() / outcome.getResult() vs. pair.getFirst() / pair.getSecond() — consistent with the @JvmName effort already invested elsewhere - Forward-compatible: optional fields (e.g. attemptNumber, latencyMs) can be added later without breaking callers; impossible with Pair - Same shape across transports (Kafka, planned HTTP, planned RabbitMQ etc.) — extracting the abstraction now is cheaper than after release Changes: - New okapi-core type: DeliveryOutcome(entry, result) - MessageDeliverer.deliverBatch signature: List<DeliveryOutcome> - CompositeMessageDeliverer routing: builds DeliveryOutcome instances, uses .associate { it.entry to it.result } for lookup map - KafkaMessageDeliverer override: constructs DeliveryOutcome on emission - Tests updated: .first/.second → .entry/.result; destructuring (entry, result) patterns unchanged (data-class componentN works) OutboxEntryProcessor consumes via destructuring — no change needed.
…fecycle intent Per CLAUDE.md 'no redundant comments': first paragraph restated what the signature and DeliveryResult subtypes already express. Second paragraph (transient, never persisted) is the load-bearing insight.
ramafasa
approved these changes
May 14, 2026
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
Replaces the anonymous tuple
List<Pair<OutboxEntry, DeliveryResult>>onMessageDeliverer.deliverBatchwith a named domain typeList<DeliveryOutcome>. Same shape (two fields), better contract.Why
The batch-delivery result is a domain concept, not a utility tuple — it deserves a name. Three concrete benefits:
Pair<OutboxEntry, DeliveryResult>DeliveryOutcomepair.first/pair.secondoutcome.entry/outcome.resultpair.getFirst()/pair.getSecond()outcome.getEntry()/outcome.getResult()attemptNumber,latencyMs, ... addable laterDeliveryResult/DeliveryInfo/MessageDelivererWhy pre-release
Currently
0.2.0-SNAPSHOT, no external consumers. Renaming after release would be a breaking change in a public API. The cost now is ~30 minutes; the cost later is a major version bump.Scope
okapi-core/.../DeliveryOutcome.kt—data class DeliveryOutcome(val entry: OutboxEntry, val result: DeliveryResult)MessageDeliverer.deliverBatchreturnsList<DeliveryOutcome>CompositeMessageDeliverer: buildsDeliveryOutcomeinstances; lookup map via.associate { it.entry to it.result }KafkaMessageDeliverer: the public override constructsDeliveryOutcomeon emission; the privateSendOutcomesealed type is untouched.first/.second→.entry/.result; destructuring(entry, result) -> ...patterns unchanged (data-classcomponentNkeeps working)OutboxEntryProcessor: consumes via destructuring — zero changesBase branch
Based on
feature/kojak-73-kafka-deliver-batch(PR #40) — cumulative with that work. Merge order: PR #40 first, then this one.Test plan
./gradlew clean ktlintFormat ktlintCheck build -x :okapi-integration-tests:test— all modules build, full unit suite passes:okapi-integration-tests:compileTestKotlin— integration test compiles against new signature