Remove forced DispatchConsistency.Isolated for outbox operations#7604
Remove forced DispatchConsistency.Isolated for outbox operations#7604
Conversation
|
@copilot try again |
This change removes the ForceBatchDispatchToBeIsolatedBehavior and changes the dispatch consistency from Isolated to Default when dispatching outbox operations. This allows transports like Azure Service Bus and Amazon SQS to use batching for better performance and lower costs. The behavior was originally added to prevent operations from being enlisted in the receive transaction, but this is already guaranteed by the outbox forcing TransportTransactionMode.ReceiveOnly, which by definition prevents outgoing messages from being enlisted in the receive transaction. Co-authored-by: danielmarbach <174258+danielmarbach@users.noreply.github.com>
Co-authored-by: danielmarbach <174258+danielmarbach@users.noreply.github.com>
andreasohlund
left a comment
There was a problem hiding this comment.
How do we deal with users that was "relying" on this behavior like. https://discuss.particular.net/t/azure-service-bus-large-number-of-commands-outbox/4483
Do we need to make this opt-in for sometime?
Maybe we'd want to allow tuning of the message batch size when using outbox? When sending messages with outbox we can prioritize performance since we are not batching for reasons of transactional consistency, maybe? |
That's interesting 🤔 today we don't have a concept of batching in core. We basically hand over either everything or what you immediate dispatch to the transport and then the transport figures out the rest. So if we preserve that for now the batch all mode probably needs to be opt-in in a minor and later become the default in a major with an enforce immediate dispatch option or in the future batch size support (larger change) |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Outbox was forcing
DispatchConsistency.Isolatedon all operations, preventing transports from batching messages. This was redundant - the outbox already enforcesTransportTransactionMode.ReceiveOnly, which by definition prevents enlistment in receive transactions.Changes
ForceBatchDispatchToBeIsolatedBehavior- Deleted behavior class and its pipeline registrationTransportReceiveToPhysicalMessageConnector- Changed outbox operation dispatch consistency fromIsolatedtoDefaultOutbox.cscomments - Clarified thatReceiveOnlymode already provides isolation guaranteesImpact
Transports supporting batching (Azure Service Bus, Amazon SQS) can now batch outbox operations, reducing latency and message operation costs.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
f.feedz.io/usr/bin/dotnet dotnet build src/NServiceBus.Core/NServiceBus.Core.csproj --no-restore(dns block)/usr/bin/dotnet dotnet build --no-restore -c Release(dns block)/usr/bin/dotnet dotnet restore src/NServiceBus.Core.Tests/NServiceBus.Core.Tests.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.