@@ -15,7 +15,7 @@ internal static class QueuePropertiesExtensions
1515 {
1616 public static XDocument Serialize ( this QueueProperties description )
1717 {
18- var queueDescriptionElements = new List < object > ( )
18+ var queueDescriptionElements = new List < XElement > ( )
1919 {
2020 new XElement ( XName . Get ( "LockDuration" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . LockDuration ) ) ,
2121 new XElement ( XName . Get ( "MaxSizeInMegabytes" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . MaxSizeInMegabytes ) ) ,
@@ -28,15 +28,20 @@ public static XDocument Serialize(this QueueProperties description)
2828 : null ,
2929 new XElement ( XName . Get ( "MaxDeliveryCount" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . MaxDeliveryCount ) ) ,
3030 new XElement ( XName . Get ( "EnableBatchedOperations" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . EnableBatchedOperations ) ) ,
31+ new XElement ( XName . Get ( "IsAnonymousAccessible" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . IsAnonymousAccessible ) ) ,
3132 description . AuthorizationRules ? . Serialize ( ) ,
3233 new XElement ( XName . Get ( "Status" , AdministrationClientConstants . ServiceBusNamespace ) , description . Status . ToString ( ) ) ,
3334 description . ForwardTo != null ? new XElement ( XName . Get ( "ForwardTo" , AdministrationClientConstants . ServiceBusNamespace ) , description . ForwardTo ) : null ,
3435 description . UserMetadata != null ? new XElement ( XName . Get ( "UserMetadata" , AdministrationClientConstants . ServiceBusNamespace ) , description . UserMetadata ) : null ,
36+ description . _internalSupportOrdering . HasValue ? new XElement ( XName . Get ( "SupportOrdering" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . _internalSupportOrdering . Value ) ) : null ,
3537 description . AutoDeleteOnIdle != TimeSpan . MaxValue ? new XElement ( XName . Get ( "AutoDeleteOnIdle" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . AutoDeleteOnIdle ) ) : null ,
3638 new XElement ( XName . Get ( "EnablePartitioning" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . EnablePartitioning ) ) ,
37- description . ForwardDeadLetteredMessagesTo != null ? new XElement ( XName . Get ( "ForwardDeadLetteredMessagesTo" , AdministrationClientConstants . ServiceBusNamespace ) , description . ForwardDeadLetteredMessagesTo ) : null
39+ description . ForwardDeadLetteredMessagesTo != null ? new XElement ( XName . Get ( "ForwardDeadLetteredMessagesTo" , AdministrationClientConstants . ServiceBusNamespace ) , description . ForwardDeadLetteredMessagesTo ) : null ,
40+ new XElement ( XName . Get ( "EnableExpress" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . EnableExpress ) )
3841 } ;
3942
43+ // Insert unknown properties in the exact order they were in the received xml.
44+ // Expectation is that servicebus will add any new elements only at the bottom of the xml tree.
4045 if ( description . UnknownProperties != null )
4146 {
4247 queueDescriptionElements . AddRange ( description . UnknownProperties ) ;
@@ -50,9 +55,6 @@ public static XDocument Serialize(this QueueProperties description)
5055 queueDescriptionElements . ToArray ( ) ) ) ) ) ;
5156 }
5257
53- /// <summary>
54- ///
55- /// </summary>
5658 public static async Task < QueueProperties > ParseResponseAsync ( Response response , ClientDiagnostics diagnostics )
5759 {
5860 try
@@ -81,7 +83,6 @@ public static async Task<QueueProperties> ParseResponseAsync(Response response,
8183 private static async Task < QueueProperties > ParseFromEntryElementAsync ( XElement xEntry , Response response , ClientDiagnostics diagnostics )
8284 {
8385 var name = xEntry . Element ( XName . Get ( "title" , AdministrationClientConstants . AtomNamespace ) ) . Value ;
84- var properties = new QueueProperties ( name ) ;
8586
8687 var qdXml = xEntry . Element ( XName . Get ( "content" , AdministrationClientConstants . AtomNamespace ) ) ?
8788 . Element ( XName . Get ( "QueueDescription" , AdministrationClientConstants . ServiceBusNamespace ) ) ;
@@ -94,10 +95,14 @@ private static async Task<QueueProperties> ParseFromEntryElementAsync(XElement x
9495 innerException : await diagnostics . CreateRequestFailedExceptionAsync ( response ) . ConfigureAwait ( false ) ) ;
9596 }
9697
98+ var properties = new QueueProperties ( name ) ;
9799 foreach ( var element in qdXml . Elements ( ) )
98100 {
99101 switch ( element . Name . LocalName )
100102 {
103+ case "LockDuration" :
104+ properties . LockDuration = XmlConvert . ToTimeSpan ( element . Value ) ;
105+ break ;
101106 case "MaxSizeInMegabytes" :
102107 properties . MaxSizeInMegabytes = int . Parse ( element . Value , CultureInfo . InvariantCulture ) ;
103108 break ;
@@ -107,65 +112,73 @@ private static async Task<QueueProperties> ParseFromEntryElementAsync(XElement x
107112 case "RequiresSession" :
108113 properties . RequiresSession = bool . Parse ( element . Value ) ;
109114 break ;
115+ case "DefaultMessageTimeToLive" :
116+ properties . DefaultMessageTimeToLive = XmlConvert . ToTimeSpan ( element . Value ) ;
117+ break ;
110118 case "DeadLetteringOnMessageExpiration" :
111119 properties . DeadLetteringOnMessageExpiration = bool . Parse ( element . Value ) ;
112120 break ;
113121 case "DuplicateDetectionHistoryTimeWindow" :
114122 properties . DuplicateDetectionHistoryTimeWindow = XmlConvert . ToTimeSpan ( element . Value ) ;
115123 break ;
116- case "LockDuration" :
117- properties . LockDuration = XmlConvert . ToTimeSpan ( element . Value ) ;
118- break ;
119- case "DefaultMessageTimeToLive" :
120- properties . DefaultMessageTimeToLive = XmlConvert . ToTimeSpan ( element . Value ) ;
121- break ;
122124 case "MaxDeliveryCount" :
123125 properties . MaxDeliveryCount = int . Parse ( element . Value , CultureInfo . InvariantCulture ) ;
124126 break ;
125127 case "EnableBatchedOperations" :
126128 properties . EnableBatchedOperations = bool . Parse ( element . Value ) ;
127129 break ;
128- case "Status" :
129- properties . Status = element . Value ;
130- break ;
131- case "AutoDeleteOnIdle" :
132- properties . AutoDeleteOnIdle = XmlConvert . ToTimeSpan ( element . Value ) ;
130+ case "IsAnonymousAccessible" :
131+ properties . IsAnonymousAccessible = Boolean . Parse ( element . Value ) ;
133132 break ;
134- case "EnablePartitioning " :
135- properties . EnablePartitioning = bool . Parse ( element . Value ) ;
133+ case "AuthorizationRules " :
134+ properties . AuthorizationRules = AuthorizationRules . ParseFromXElement ( element ) ;
136135 break ;
137- case "UserMetadata " :
138- properties . UserMetadata = element . Value ;
136+ case "Status " :
137+ properties . Status = element . Value ;
139138 break ;
140139 case "ForwardTo" :
141140 if ( ! string . IsNullOrWhiteSpace ( element . Value ) )
142141 {
143142 properties . ForwardTo = element . Value ;
144143 }
145144 break ;
145+ case "UserMetadata" :
146+ properties . UserMetadata = element . Value ;
147+ break ;
148+ case "SupportOrdering" :
149+ properties . SupportOrdering = Boolean . Parse ( element . Value ) ;
150+ break ;
151+ case "AutoDeleteOnIdle" :
152+ properties . AutoDeleteOnIdle = XmlConvert . ToTimeSpan ( element . Value ) ;
153+ break ;
154+ case "EnablePartitioning" :
155+ properties . EnablePartitioning = bool . Parse ( element . Value ) ;
156+ break ;
146157 case "ForwardDeadLetteredMessagesTo" :
147158 if ( ! string . IsNullOrWhiteSpace ( element . Value ) )
148159 {
149160 properties . ForwardDeadLetteredMessagesTo = element . Value ;
150161 }
151162 break ;
152- case "AuthorizationRules " :
153- properties . AuthorizationRules = AuthorizationRules . ParseFromXElement ( element ) ;
163+ case "EnableExpress " :
164+ properties . EnableExpress = bool . Parse ( element . Value ) ;
154165 break ;
155166 case "AccessedAt" :
156167 case "CreatedAt" :
157168 case "MessageCount" :
158169 case "SizeInBytes" :
159170 case "UpdatedAt" :
160171 case "CountDetails" :
172+ case "EntityAvailabilityStatus" :
173+ case "SkippedUpdate" :
161174 // Ignore known properties
162175 // Do nothing
163176 break ;
164177 default :
165178 // For unknown properties, keep them as-is for forward proof.
166179 if ( properties . UnknownProperties == null )
167180 {
168- properties . UnknownProperties = new List < object > ( ) ;
181+ properties . UnknownProperties = new List < XElement > ( ) ;
169182 }
170183
171184 properties . UnknownProperties . Add ( element ) ;
0 commit comments