-
Notifications
You must be signed in to change notification settings - Fork 5
Support for NServiceBus.Transport.AzureServiceBus v5 #888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8531371
Bump Azure Service Bus
danielmarbach 2809824
Add hashing package
danielmarbach 6538ad3
Acceptance test support
danielmarbach 6789f67
Adjust prod code
danielmarbach 3843205
Cleanup and add tests
danielmarbach 3549ec3
Slightly smarter configuration forwarding
danielmarbach 7a39285
Cleanup startup
danielmarbach 0588390
Fix analyzer tests
danielmarbach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
39 changes: 39 additions & 0 deletions
39
src/ServiceBus.AcceptanceTests/AcceptanceTestExtensions.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| namespace ServiceBus.Tests; | ||
|
|
||
| using System; | ||
| using System.IO.Hashing; | ||
| using System.Text; | ||
|
|
||
| public static class AcceptanceTestExtensions | ||
| { | ||
| public static string ToTopicName(this Type eventType) => | ||
| eventType.FullName.Replace("+", ".").Shorten(maxLength: 260); | ||
|
|
||
| // The idea here is to preserve part of the text and append a non-cryptographic hash to it. | ||
| // This way, we can have a deterministic and unique names without harming much the readability. | ||
| // The chance of collisions should be very low but definitely not zero. We can always switch to | ||
| // using more bits in the hash or even back to a cryptographic hash if needed. | ||
| public static string Shorten(this string name, int maxLength = 50) | ||
| { | ||
| if (name.Length <= maxLength) | ||
| { | ||
| return name; | ||
| } | ||
|
|
||
| var nameBytes = Encoding.UTF8.GetBytes(name); | ||
| var hashValue = XxHash32.Hash(nameBytes); | ||
| string hashHex = Convert.ToHexString(hashValue); | ||
|
|
||
| int prefixLength = maxLength - hashHex.Length; | ||
|
|
||
| if (prefixLength < 0) | ||
| { | ||
| return hashHex.Length > maxLength | ||
| ? hashHex[..maxLength] // in case even the hash is too long | ||
| : hashHex; | ||
| } | ||
|
|
||
| string prefix = name[..Math.Min(prefixLength, name.Length)]; | ||
| return $"{prefix}{hashHex}"; | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity: what is the value of adding
_?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not much other than clearly showing that the return type is not being consumed