question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] EnableCrossEntityTransactions does not allow multiple processors. Is Send-Via still possible?

See original GitHub issue

Library 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:closed
  • Created 6 months ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
github-actions[bot]commented, Mar 28, 2023

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.

0reactions
rbertelscommented, Apr 6, 2023

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for Cross Entity transactions · Issue #17355
This option should not be set if a user does not need to span multiple entities in a transaction. They can just do...
Read more >
Overview of transaction processing in Azure Service Bus
This article gives you an overview of transaction processing and the send via feature in Azure Service Bus.
Read more >
Azure Service Bus - Is EnableCrossEntityTransactions ...
While the subscription used to receive is under the same topic used to dispatch to, those are two different entities.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found