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.

MessageSender abstraction is broken for Path when Send-Via is used

See original GitHub issue

Actual Behavior

MessageSender supports Send-Via feature. Send-Via is using a transfer queue to route message to their final destination when using transactional processing. The abstraction is represented by a public overload of MessageSender that takes in two paths

  1. entitytPath
  2. viaEntityPath https://github.com/Azure/azure-service-bus-dotnet/blob/e278f87b0b3aa563ab055918e988baec9ec155a3/src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs#L127-L135

The abstraction has been copied from the old client and works, but it’s broken when Path and TransferDestinationPath are queried back. That’s because all public overloads are invoking an internal overload, swapping the two paths: https://github.com/Azure/azure-service-bus-dotnet/blob/e278f87b0b3aa563ab055918e988baec9ec155a3/src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs#L132

where internal overload is https://github.com/Azure/azure-service-bus-dotnet/blob/e278f87b0b3aa563ab055918e988baec9ec155a3/src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs#L137-L144

assigning viaEntityPath to this.Path and entityPath to this.TransferDestinationPath. Which is inverted.

Expected Behavior

Path and Send-Via/TransferDestinationPath after MessageSender constructor is invoked should be identical to the values passed in.

Repro

LinqPad repro script attached.

var sender1 = new MessageSender(connection, "path");
sender1.Path.Dump("Should be 'path'");
Assert.IsNull(sender1.TransferDestinationPath); // green

var sender2 = new MessageSender(connection, "path", "intermediate");
Assert.AreEqual("path", sender2.Path); // red, equals to "intermediate"
Assert.AreEqual("intermediate", sender2.TransferDestinationPath); // red, equals to "path"

Recommendations

The fix should be released as a major version for the following reasons:

  1. This is a breaking change. While a fix will restore the correct behaviour, it will affect any existing solution relying on the incorrect implementation.
  2. Anyone implementing a workaround will be broken if they update to a patch/minor.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
nemakamcommented, Sep 28, 2018

Yes

0reactions
SeanFeldmancommented, Jul 17, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Pull requests · Azure/azure-service-bus-dotnet
[WIP] verification test for MessageSender abstraction is broken for Path when Send-Via is used. #570 opened on Sep 11, 2018 by SeanFeldman ...
Read more >
Azure – Page 2
I have broken the solution into 2 projects, one for the Azure Functions and the other for the Helper classes. I typically abstract...
Read more >
Functions
Azure Functions need to have the IsSessionsEnabled property set to enabled on the SB input binding. This feature for Azure Functions to use...
Read more >
NEWS
Re-defined logic for the 'smsbox-route' group that is used for MO routing to different (identified) smsbox connections. * Changed main message structure to ......
Read more >
Secure Message Transmission and its Applications
In this model each path from a sender reaches multiple receivers, with all receivers receiving the same information from their common network communication ......
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