-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Add EnablePartitioning to QueueProperties ctor; rename GetRawMessage #17101
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,15 +28,20 @@ public static XDocument Serialize(this QueueProperties description) | |
| : null, | ||
| new XElement(XName.Get("MaxDeliveryCount", AdministrationClientConstants.ServiceBusNamespace), XmlConvert.ToString(description.MaxDeliveryCount)), | ||
| new XElement(XName.Get("EnableBatchedOperations", AdministrationClientConstants.ServiceBusNamespace), XmlConvert.ToString(description.EnableBatchedOperations)), | ||
| new XElement(XName.Get("IsAnonymousAccessible", AdministrationClientConstants.ServiceBusNamespace), XmlConvert.ToString(description.IsAnonymousAccessible)), | ||
| description.AuthorizationRules?.Serialize(), | ||
| new XElement(XName.Get("Status", AdministrationClientConstants.ServiceBusNamespace), description.Status.ToString()), | ||
| description.ForwardTo != null ? new XElement(XName.Get("ForwardTo", AdministrationClientConstants.ServiceBusNamespace), description.ForwardTo) : null, | ||
| description.UserMetadata != null ? new XElement(XName.Get("UserMetadata", AdministrationClientConstants.ServiceBusNamespace), description.UserMetadata) : null, | ||
| description._internalSupportOrdering.HasValue ? new XElement(XName.Get("SupportOrdering", AdministrationClientConstants.ServiceBusNamespace), XmlConvert.ToString(description._internalSupportOrdering.Value)) : null, | ||
| description.AutoDeleteOnIdle != TimeSpan.MaxValue ? new XElement(XName.Get("AutoDeleteOnIdle", AdministrationClientConstants.ServiceBusNamespace), XmlConvert.ToString(description.AutoDeleteOnIdle)) : null, | ||
| new XElement(XName.Get("EnablePartitioning", AdministrationClientConstants.ServiceBusNamespace), XmlConvert.ToString(description.EnablePartitioning)), | ||
| description.ForwardDeadLetteredMessagesTo != null ? new XElement(XName.Get("ForwardDeadLetteredMessagesTo", AdministrationClientConstants.ServiceBusNamespace), description.ForwardDeadLetteredMessagesTo) : null | ||
| description.ForwardDeadLetteredMessagesTo != null ? new XElement(XName.Get("ForwardDeadLetteredMessagesTo", AdministrationClientConstants.ServiceBusNamespace), description.ForwardDeadLetteredMessagesTo) : null, | ||
| new XElement(XName.Get("EnableExpress", AdministrationClientConstants.ServiceBusNamespace), XmlConvert.ToString(description.EnableExpress)) | ||
| }; | ||
|
|
||
| // Insert unknown properties in the exact order they were in the received xml. | ||
| // Expectation is that servicebus will add any new elements only at the bottom of the xml tree. | ||
| if (description.UnknownProperties != null) | ||
| { | ||
| queueDescriptionElements.AddRange(description.UnknownProperties); | ||
|
|
@@ -50,9 +55,6 @@ public static XDocument Serialize(this QueueProperties description) | |
| queueDescriptionElements.ToArray())))); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| public static async Task<QueueProperties> ParseResponseAsync(Response response, ClientDiagnostics diagnostics) | ||
| { | ||
| try | ||
|
|
@@ -81,7 +83,6 @@ public static async Task<QueueProperties> ParseResponseAsync(Response response, | |
| private static async Task<QueueProperties> ParseFromEntryElementAsync(XElement xEntry, Response response, ClientDiagnostics diagnostics) | ||
| { | ||
| var name = xEntry.Element(XName.Get("title", AdministrationClientConstants.AtomNamespace)).Value; | ||
| var properties = new QueueProperties(name); | ||
|
|
||
| var qdXml = xEntry.Element(XName.Get("content", AdministrationClientConstants.AtomNamespace))? | ||
| .Element(XName.Get("QueueDescription", AdministrationClientConstants.ServiceBusNamespace)); | ||
|
|
@@ -94,10 +95,14 @@ private static async Task<QueueProperties> ParseFromEntryElementAsync(XElement x | |
| innerException: await diagnostics.CreateRequestFailedExceptionAsync(response).ConfigureAwait(false)); | ||
| } | ||
|
|
||
| var properties = new QueueProperties(name); | ||
| foreach (var element in qdXml.Elements()) | ||
| { | ||
| switch (element.Name.LocalName) | ||
| { | ||
| case "LockDuration": | ||
| properties.LockDuration = XmlConvert.ToTimeSpan(element.Value); | ||
| break; | ||
| case "MaxSizeInMegabytes": | ||
| properties.MaxSizeInMegabytes = int.Parse(element.Value, CultureInfo.InvariantCulture); | ||
| break; | ||
|
|
@@ -107,65 +112,73 @@ private static async Task<QueueProperties> ParseFromEntryElementAsync(XElement x | |
| case "RequiresSession": | ||
| properties.RequiresSession = bool.Parse(element.Value); | ||
| break; | ||
| case "DefaultMessageTimeToLive": | ||
| properties.DefaultMessageTimeToLive = XmlConvert.ToTimeSpan(element.Value); | ||
| break; | ||
| case "DeadLetteringOnMessageExpiration": | ||
| properties.DeadLetteringOnMessageExpiration = bool.Parse(element.Value); | ||
| break; | ||
| case "DuplicateDetectionHistoryTimeWindow": | ||
| properties.DuplicateDetectionHistoryTimeWindow = XmlConvert.ToTimeSpan(element.Value); | ||
| break; | ||
| case "LockDuration": | ||
| properties.LockDuration = XmlConvert.ToTimeSpan(element.Value); | ||
| break; | ||
| case "DefaultMessageTimeToLive": | ||
| properties.DefaultMessageTimeToLive = XmlConvert.ToTimeSpan(element.Value); | ||
| break; | ||
| case "MaxDeliveryCount": | ||
| properties.MaxDeliveryCount = int.Parse(element.Value, CultureInfo.InvariantCulture); | ||
| break; | ||
| case "EnableBatchedOperations": | ||
| properties.EnableBatchedOperations = bool.Parse(element.Value); | ||
| break; | ||
| case "Status": | ||
| properties.Status = element.Value; | ||
| break; | ||
| case "AutoDeleteOnIdle": | ||
| properties.AutoDeleteOnIdle = XmlConvert.ToTimeSpan(element.Value); | ||
| case "IsAnonymousAccessible": | ||
| properties.IsAnonymousAccessible = Boolean.Parse(element.Value); | ||
| break; | ||
| case "EnablePartitioning": | ||
| properties.EnablePartitioning = bool.Parse(element.Value); | ||
| case "AuthorizationRules": | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not worth taking on this close to code complete, but may be worth a follow-up at some point to pull the magic strings out into a set of constants. |
||
| properties.AuthorizationRules = AuthorizationRules.ParseFromXElement(element); | ||
| break; | ||
| case "UserMetadata": | ||
| properties.UserMetadata = element.Value; | ||
| case "Status": | ||
| properties.Status = element.Value; | ||
| break; | ||
| case "ForwardTo": | ||
| if (!string.IsNullOrWhiteSpace(element.Value)) | ||
| { | ||
| properties.ForwardTo = element.Value; | ||
| } | ||
| break; | ||
| case "UserMetadata": | ||
| properties.UserMetadata = element.Value; | ||
| break; | ||
| case "SupportOrdering": | ||
| properties.SupportOrdering = Boolean.Parse(element.Value); | ||
| break; | ||
| case "AutoDeleteOnIdle": | ||
| properties.AutoDeleteOnIdle = XmlConvert.ToTimeSpan(element.Value); | ||
| break; | ||
| case "EnablePartitioning": | ||
| properties.EnablePartitioning = bool.Parse(element.Value); | ||
| break; | ||
| case "ForwardDeadLetteredMessagesTo": | ||
| if (!string.IsNullOrWhiteSpace(element.Value)) | ||
| { | ||
| properties.ForwardDeadLetteredMessagesTo = element.Value; | ||
| } | ||
| break; | ||
| case "AuthorizationRules": | ||
| properties.AuthorizationRules = AuthorizationRules.ParseFromXElement(element); | ||
| case "EnableExpress": | ||
| properties.EnableExpress = bool.Parse(element.Value); | ||
| break; | ||
| case "AccessedAt": | ||
| case "CreatedAt": | ||
| case "MessageCount": | ||
| case "SizeInBytes": | ||
| case "UpdatedAt": | ||
| case "CountDetails": | ||
| case "EntityAvailabilityStatus": | ||
| case "SkippedUpdate": | ||
| // Ignore known properties | ||
| // Do nothing | ||
| break; | ||
| default: | ||
| // For unknown properties, keep them as-is for forward proof. | ||
| if (properties.UnknownProperties == null) | ||
| { | ||
| properties.UnknownProperties = new List<object>(); | ||
| properties.UnknownProperties = new List<XElement>(); | ||
| } | ||
|
|
||
| properties.UnknownProperties.Add(element); | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.