Repository navigation
[Mocha] Signal the outbox processor only when a transaction wrote an outbox message - #11110
Open
PascalSenn wants to merge 5 commits into
Open
PascalSenn wants to merge 5 commits into
PascalSenn wants to merge 5 commits into
Conversation
…t signaled about An idle outbox processor waited for its signal without a timeout. A row committed without a signal, for example in a transaction that is committed outside EF Core or by another process, stayed in the outbox until something else woke the processor. The processor now also wakes after PostgresOutboxOptions.PollingInterval, ten seconds by default, and an interval that is not positive is rejected. It logs that it is sleeping only when it waits for a message that is due before the next check.
…Contexts use it UsePostgresOutbox() registered the processor and its worker as plain singletons, so with two contexts the host ran only the processor of the context registered last and the rows of the other context were never sent. All processors also waited on one IOutboxSignal. Each context now gets its own processor, registered as a keyed singleton with the context type as key, its own worker and its own IOutboxSignal, registered with the same key. The outbox interceptors read the signal from the context they are called for, so a save or commit signals only the processor of that context. Calling UsePostgresOutbox() or UseOutboxCore() again for the same context registers nothing twice and still applies the configure delegate. IMessageBus publishes keep using the outbox of the first context, and the exception for a missing transaction now says so. The tests no longer replace the outbox signal with ResilientOutboxSignal, and the helper is removed.
…tbox-split-6-signal-on-write
…Contexts These tests need both the polling interval and the outbox processor per DbContext. The repeated registration tests check that the polling interval validation is registered once and that the second configure delegate is applied and validated. The relay clock tests register their outbox signal with the DbContext type as key, and the multiple context tests keep an idle relay from polling.
…t wrote no outbox message Every SaveChanges and every transaction commit on an outbox context signaled the outbox processor, so the processor queried the outbox table after each of them, whether or not a message was written. The outbox now marks its context when it writes a message inside a database transaction, and the commit interceptor signals only when the mark is set. OutboxSaveChangesInterceptor is removed, so a save no longer signals. An OutboxMessage entity that is added through the change tracker is found when the processor next checks the database.
PascalSenn
marked this pull request as ready for review
November 29, 2026 13:38
Contributor
This branch has not been deployed
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.
Split out of #11017. Builds on #11108 and #11109, merge after both. The branch contains a merge of the two, so the diff against
mainincludes them.Own commits:
241c91fc0dholds four tests that need both [Mocha] Fix the outbox processor never checking for messages it is not signaled about #11108 and [Mocha] Fix the Postgres outbox running one processor when several DbContexts use it #11109. It belongs to whichever of the two merges second.1491930d88is the change of this PR.Changes:
OutboxSaveChangesInterceptoris removed. A save no longer wakes the processor.OutboxMessageentity that is added through the change tracker is found when the processor next checks the database.