@@ -15,7 +15,7 @@ internal static class QueuePropertiesExtensions
15
15
{
16
16
public static XDocument Serialize ( this QueueProperties description )
17
17
{
18
- var queueDescriptionElements = new List < object > ( )
18
+ var queueDescriptionElements = new List < XElement > ( )
19
19
{
20
20
new XElement ( XName . Get ( "LockDuration" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . LockDuration ) ) ,
21
21
new XElement ( XName . Get ( "MaxSizeInMegabytes" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . MaxSizeInMegabytes ) ) ,
@@ -28,15 +28,20 @@ public static XDocument Serialize(this QueueProperties description)
28
28
: null ,
29
29
new XElement ( XName . Get ( "MaxDeliveryCount" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . MaxDeliveryCount ) ) ,
30
30
new XElement ( XName . Get ( "EnableBatchedOperations" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . EnableBatchedOperations ) ) ,
31
+ new XElement ( XName . Get ( "IsAnonymousAccessible" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . IsAnonymousAccessible ) ) ,
31
32
description . AuthorizationRules ? . Serialize ( ) ,
32
33
new XElement ( XName . Get ( "Status" , AdministrationClientConstants . ServiceBusNamespace ) , description . Status . ToString ( ) ) ,
33
34
description . ForwardTo != null ? new XElement ( XName . Get ( "ForwardTo" , AdministrationClientConstants . ServiceBusNamespace ) , description . ForwardTo ) : null ,
34
35
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 ,
35
37
description . AutoDeleteOnIdle != TimeSpan . MaxValue ? new XElement ( XName . Get ( "AutoDeleteOnIdle" , AdministrationClientConstants . ServiceBusNamespace ) , XmlConvert . ToString ( description . AutoDeleteOnIdle ) ) : null ,
36
38
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 ) )
38
41
} ;
39
42
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.
40
45
if ( description . UnknownProperties != null )
41
46
{
42
47
queueDescriptionElements . AddRange ( description . UnknownProperties ) ;
@@ -50,9 +55,6 @@ public static XDocument Serialize(this QueueProperties description)
50
55
queueDescriptionElements . ToArray ( ) ) ) ) ) ;
51
56
}
52
57
53
- /// <summary>
54
- ///
55
- /// </summary>
56
58
public static async Task < QueueProperties > ParseResponseAsync ( Response response , ClientDiagnostics diagnostics )
57
59
{
58
60
try
@@ -81,7 +83,6 @@ public static async Task<QueueProperties> ParseResponseAsync(Response response,
81
83
private static async Task < QueueProperties > ParseFromEntryElementAsync ( XElement xEntry , Response response , ClientDiagnostics diagnostics )
82
84
{
83
85
var name = xEntry . Element ( XName . Get ( "title" , AdministrationClientConstants . AtomNamespace ) ) . Value ;
84
- var properties = new QueueProperties ( name ) ;
85
86
86
87
var qdXml = xEntry . Element ( XName . Get ( "content" , AdministrationClientConstants . AtomNamespace ) ) ?
87
88
. Element ( XName . Get ( "QueueDescription" , AdministrationClientConstants . ServiceBusNamespace ) ) ;
@@ -94,10 +95,14 @@ private static async Task<QueueProperties> ParseFromEntryElementAsync(XElement x
94
95
innerException : await diagnostics . CreateRequestFailedExceptionAsync ( response ) . ConfigureAwait ( false ) ) ;
95
96
}
96
97
98
+ var properties = new QueueProperties ( name ) ;
97
99
foreach ( var element in qdXml . Elements ( ) )
98
100
{
99
101
switch ( element . Name . LocalName )
100
102
{
103
+ case "LockDuration" :
104
+ properties . LockDuration = XmlConvert . ToTimeSpan ( element . Value ) ;
105
+ break ;
101
106
case "MaxSizeInMegabytes" :
102
107
properties . MaxSizeInMegabytes = int . Parse ( element . Value , CultureInfo . InvariantCulture ) ;
103
108
break ;
@@ -107,65 +112,73 @@ private static async Task<QueueProperties> ParseFromEntryElementAsync(XElement x
107
112
case "RequiresSession" :
108
113
properties . RequiresSession = bool . Parse ( element . Value ) ;
109
114
break ;
115
+ case "DefaultMessageTimeToLive" :
116
+ properties . DefaultMessageTimeToLive = XmlConvert . ToTimeSpan ( element . Value ) ;
117
+ break ;
110
118
case "DeadLetteringOnMessageExpiration" :
111
119
properties . DeadLetteringOnMessageExpiration = bool . Parse ( element . Value ) ;
112
120
break ;
113
121
case "DuplicateDetectionHistoryTimeWindow" :
114
122
properties . DuplicateDetectionHistoryTimeWindow = XmlConvert . ToTimeSpan ( element . Value ) ;
115
123
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 ;
122
124
case "MaxDeliveryCount" :
123
125
properties . MaxDeliveryCount = int . Parse ( element . Value , CultureInfo . InvariantCulture ) ;
124
126
break ;
125
127
case "EnableBatchedOperations" :
126
128
properties . EnableBatchedOperations = bool . Parse ( element . Value ) ;
127
129
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 ) ;
133
132
break ;
134
- case "EnablePartitioning " :
135
- properties . EnablePartitioning = bool . Parse ( element . Value ) ;
133
+ case "AuthorizationRules " :
134
+ properties . AuthorizationRules = AuthorizationRules . ParseFromXElement ( element ) ;
136
135
break ;
137
- case "UserMetadata " :
138
- properties . UserMetadata = element . Value ;
136
+ case "Status " :
137
+ properties . Status = element . Value ;
139
138
break ;
140
139
case "ForwardTo" :
141
140
if ( ! string . IsNullOrWhiteSpace ( element . Value ) )
142
141
{
143
142
properties . ForwardTo = element . Value ;
144
143
}
145
144
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 ;
146
157
case "ForwardDeadLetteredMessagesTo" :
147
158
if ( ! string . IsNullOrWhiteSpace ( element . Value ) )
148
159
{
149
160
properties . ForwardDeadLetteredMessagesTo = element . Value ;
150
161
}
151
162
break ;
152
- case "AuthorizationRules " :
153
- properties . AuthorizationRules = AuthorizationRules . ParseFromXElement ( element ) ;
163
+ case "EnableExpress " :
164
+ properties . EnableExpress = bool . Parse ( element . Value ) ;
154
165
break ;
155
166
case "AccessedAt" :
156
167
case "CreatedAt" :
157
168
case "MessageCount" :
158
169
case "SizeInBytes" :
159
170
case "UpdatedAt" :
160
171
case "CountDetails" :
172
+ case "EntityAvailabilityStatus" :
173
+ case "SkippedUpdate" :
161
174
// Ignore known properties
162
175
// Do nothing
163
176
break ;
164
177
default :
165
178
// For unknown properties, keep them as-is for forward proof.
166
179
if ( properties . UnknownProperties == null )
167
180
{
168
- properties . UnknownProperties = new List < object > ( ) ;
181
+ properties . UnknownProperties = new List < XElement > ( ) ;
169
182
}
170
183
171
184
properties . UnknownProperties . Add ( element ) ;
0 commit comments