Unify scheduled message store via PersistAsync#9616
Draft
PascalSenn wants to merge 3 commits intopse/adds-azure-serivce-ubsfrom
Draft
Unify scheduled message store via PersistAsync#9616PascalSenn wants to merge 3 commits intopse/adds-azure-serivce-ubsfrom
PascalSenn wants to merge 3 commits intopse/adds-azure-serivce-ubsfrom
Conversation
Replace the SupportsSchedulingNatively dual-path with a single resolver that routes scheduled dispatches and cancellations through one IScheduledMessageStore per transport. - IScheduledMessageStore.PersistAsync now takes IDispatchContext - New IScheduledMessageStoreResolver picks the store by transport type for dispatch and by token prefix for cancellation - DispatchSchedulingMiddleware always runs in the default pipeline - Azure Service Bus and Postgres transports register transport-specific stores; EfCoreScheduledMessageStore is the optional fallback - Endpoints lose the ScheduledTime branch and become send-now terminals - SchedulingTransportFeature deleted
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
Collapses the two scheduling code paths in Mocha (middleware-store vs. endpoint-native) into a single resolver-routed
IScheduledMessageStore.PersistAsynccall. RemovesSchedulingTransportFeature.SupportsSchedulingNatively.IScheduledMessageStore.PersistAsyncnow takesIDispatchContext. The store reads envelope, scheduled time, transport, and endpoint from the context.IScheduledMessageStoreResolverselects the store for a scheduled dispatch by transport type and for cancellation by token prefix.DispatchSchedulingMiddlewareis always present in the default dispatch pipeline; resolves and invokes the right store at runtime.EfCoreScheduledMessageStorebecomes the optional fallback for non-native transports.AzureServiceBusDispatchEndpointandPostgresDispatchEndpointlose theirScheduledTimebranches and become send-now terminals. Provisioning + entity-path resolution + message construction are extracted to shared helpers.NotSupportedExceptioninstead of being sent immediately.The full design rationale, alternatives considered, and trade-offs are in
plan.md.Test plan
dotnet build src/Mocha/Mocha.slnx— 0 errorsdotnet test src/Mocha/test/Mocha.Tests --filter "FullyQualifiedName~Scheduling|FullyQualifiedName~ScheduledMessage"— 45/45 pass on net8.0/net9.0/net10.0Mocha.Transport.InMemory.Tests— 162/162 pass (covers redelivery + scheduling regressions)Mocha.Sagas.Tests— 127/127 pass (saga timeouts viaScheduleSendAsync)Mocha.Transport.AzureServiceBus.Tests/Behaviors/SchedulingTests.csMocha.Transport.Postgres.Tests/Behaviors/SchedulingTests.cs