Run the outbox relay cycle in the engine: stores own only the transaction, claim, record and commit, and drop the options parameter - #428
Merged
Conversation
…tion, claim, record and commit, and drop the options parameter
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
The outbox relay cycle now lives in one engine module. The store keeps only the transactional boundary.
IOutboxStore.ProcessBatchAsync(dispatch)is replaced byRunRelayUnitAsync(unit). The store opens the transaction (inside its execution strategy), passes the engine a newIOutboxRelayUnit(ClaimAsync,RecordAsync), and commits when the unit returns.OutboxRelayCycle(wasOutboxProcessor) owns the dispatch rules: batch size and retry limit, dispatch in sequence or in parallel, theMaxDegreeOfParallelismthrottle, and the cancel rule. Before, the store had its own copy of the parallel fan-out and throttle. The back-off rule moves toOutboxRelayBackoff, so it can be tested without the hosted service.EntityFrameworkOutboxStore<TContext>and its 4 subclasses drop theIOptions<OutboxProcessingOptions>constructor parameter, because the store no longer reads the options.OutboxRelayCycleTestsrun the real cycle against an in-memory store (claim arguments, empty claim, scope per mode, deterministic throttle check, failures, cancel rule).OutboxRelayBackoffTestscover the back-off rule. The store tests drive one relay unit through a shared test helper (tests/Shared/OutboxRelayUnitTestExtensions.cs). The duplicate throttle test on the EF store is deleted.Breaking changes (2.0 line)
Reason: a leaked implementation seam. The store interface carried the engine's batch logic, so
EnableParallelPublishingandBatchSizewere read in two places.IOutboxStore.ProcessBatchAsyncis removed, andIOutboxStore.RunRelayUnitAsync<TResult>is added.EntityFrameworkOutboxStore<TContext>.ProcessBatchAsyncis removed.IOptions<OutboxProcessingOptions>constructor parameter is removed fromEntityFrameworkOutboxStore,RelationalOutboxStore,NpgsqlOutboxStore,MySqlOutboxStoreandCosmosOutboxStore.Each break has a CompatibilitySuppressions entry (
IsBaselineSuppression) and a*REMOVED*PublicAPI line.One small runtime difference: an idle cycle (empty claim) now commits its empty transaction. Before, it rolled the transaction back on dispose. No data changes, and the commit does not wake the relay.
Verification
dotnet build Vulthil.SharedKernel.slnx: 0 warnings, 0 errors.Vulthil.IntegrationTests(Postgres, MySQL and Cosmos with Testcontainers): 68/68 on net10.0 and on net9.0.MessagingIntegrationTests: 13/13 on net10.0.dotnet packpackage validation against 1.2.0 passes for the 6 changed packages.Backport to v1.0: no (breaking change on the 2.0 line).