[QUERY] EnableCrossEntityTransactions does not allow multiple processors. Is Send-Via still possible?
See original GitHub issueLibrary name and version
Azure.Messaging.ServiceBus 7.13.1
Query/Question
Hi folks!
I’m trying to port our application to use the newest version of the service bus SDK. Our app uses a lot of queues and transactions are essential for our business.
When writing a small test I hit a blocker quite early: a 2nd processor on a different queue cannot do any work if the client is the same. It will raise an exception saying Local transactions cannot span multiple top-level entities such as queue or topic
even without starting any transactions. Attached is a small repro case.
var client = new ServiceBusClient(cs, new ServiceBusClientOptions()
{
EnableCrossEntityTransactions = true
});
ServiceBusProcessor CreateProcessor(string queueName)
{
async Task EchoContent(ProcessMessageEventArgs args)
{
Console.WriteLine(args.Message.Body.ToString());
await args.CompleteMessageAsync(args.Message);
}
Task Error(ProcessErrorEventArgs args)
{
Console.WriteLine(args.Exception.Message);
return Task.CompletedTask;
}
var prc = client.CreateProcessor(queueName, new ServiceBusProcessorOptions()
{
AutoCompleteMessages = false
});
prc.ProcessMessageAsync += EchoContent;
prc.ProcessErrorAsync += Error;
return prc;
}
var processor1 = CreateProcessor("queue1");
var processor2 = CreateProcessor("queue2");
await processor1.StartProcessingAsync();
await processor2.StartProcessingAsync();
This seems related to #34714 but the solution of creating a new service bus connection for every processor seems like a poor fit. We have hundreds of queues and some may be created at runtime. Our current solution using Send-Via works very well and it is one of the reasons we are sticking to Azure + ServiceBus.
It is totally understandable that Send-Via was not easy to grasp at all but is there any way to use that pattern again? I’d be happy to try to implement it if it hasn’t been removed intentionally.
Thank you for reading and have a great day!
Environment
Environment:
.NET SDK: Version: 7.0.101 Commit: bb24aafa11
Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.101\
Host: Version: 7.0.1 Architecture: x64 Commit: 97203d38ba
.NET SDKs installed: 3.1.425 [C:\Program Files\dotnet\sdk] 6.0.403 [C:\Program Files\dotnet\sdk] 7.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
IDE:
Rider 2022.3
Issue Analytics
- State:
- Created 6 months ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
Hi @rbertels. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
Thank you Josh,
With this information I am sure I can make things work somehow. No more questions from my end so let’s close this issue.
Have a nice day!