Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 9b22eab

Browse files
authored
Merge pull request #608 from Azure/dev
Release 3.2.0
2 parents b9ae045 + 47307b6 commit 9b22eab

15 files changed

+148
-62
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,3 @@ In order to run the unit tests, you will need to do the following:
5050
1. Add an Environment Variable named `azure-service-bus-dotnet/connectionstring` and set the value as the connection string of the newly created namespace. **Please note that if you are using Visual Studio, you must restart Visual Studio in order to use new Environment Variables.**
5151

5252
Once you have completed the above, you can run `dotnet test` from the `/test/Microsoft.Azure.ServiceBus.UnitTests` directory.
53-
54-
### Can I manage Service Bus entities with this library?
55-
56-
The standard way to manage Azure resources is by using [Azure Resource Manager](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview). In order to use functionality that previously existed in the .NET Framework Service Bus client library, you will need to use the `Microsoft.Azure.Management.ServiceBus` library. This will enable use cases that dynamically create/read/update/delete resources. The following links will provide more information on the new library and how to use it.
57-
58-
* GitHub repo - [https://github.com/Azure/azure-sdk-for-net/tree/AutoRest/src/ResourceManagement/ServiceBus](https://github.com/Azure/azure-sdk-for-net/tree/AutoRest/src/ResourceManagement/ServiceBus)
59-
* NuGet package - [https://www.nuget.org/packages/Microsoft.Azure.Management.ServiceBus/](https://www.nuget.org/packages/Microsoft.Azure.Management.ServiceBus/)
60-
* Sample - [https://github.com/Azure-Samples/service-bus-dotnet-management](https://github.com/Azure-Samples/service-bus-dotnet-management)

src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static AmqpMessage SBMessageToAmqpMessage(SBMessage sbMessage)
164164
return amqpMessage;
165165
}
166166

167-
public static SBMessage AmqpMessageToSBMessage(AmqpMessage amqpMessage)
167+
public static SBMessage AmqpMessageToSBMessage(AmqpMessage amqpMessage, bool isPeeked = false)
168168
{
169169
if (amqpMessage == null)
170170
{
@@ -229,7 +229,7 @@ public static SBMessage AmqpMessageToSBMessage(AmqpMessage amqpMessage)
229229

230230
if (amqpMessage.Header.DeliveryCount != null)
231231
{
232-
sbMessage.SystemProperties.DeliveryCount = (int)(amqpMessage.Header.DeliveryCount.Value + 1);
232+
sbMessage.SystemProperties.DeliveryCount = isPeeked ? (int)(amqpMessage.Header.DeliveryCount.Value) : (int)(amqpMessage.Header.DeliveryCount.Value + 1);
233233
}
234234
}
235235

src/Microsoft.Azure.ServiceBus/Core/MessageReceiver.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public MessageReceiver(
9797
{
9898
throw Fx.Exception.ArgumentNullOrWhiteSpace(connectionString);
9999
}
100-
100+
101101
this.OwnsConnection = true;
102102
}
103103

@@ -158,7 +158,7 @@ internal MessageReceiver(
158158
string sessionId = null,
159159
bool isSessionReceiver = false)
160160
: base(nameof(MessageReceiver), entityPath, retryPolicy ?? RetryPolicy.Default)
161-
{
161+
{
162162
MessagingEventSource.Log.MessageReceiverCreateStart(serviceBusConnection?.Endpoint.Authority, entityPath, receiveMode.ToString());
163163

164164
if (string.IsNullOrWhiteSpace(entityPath))
@@ -512,7 +512,7 @@ public async Task CompleteAsync(IEnumerable<string> lockTokens)
512512
var lockTokenList = lockTokens.ToList();
513513
if (lockTokenList.Count == 0)
514514
{
515-
throw Fx.Exception.ArgumentNull(nameof(lockTokens));
515+
throw Fx.Exception.Argument(nameof(lockTokens), Resources.ListOfLockTokensCannotBeEmpty);
516516
}
517517

518518
MessagingEventSource.Log.MessageCompleteStart(this.ClientId, lockTokenList.Count, lockTokenList);
@@ -1102,7 +1102,7 @@ protected virtual async Task<IList<Message>> OnPeekAsync(long fromSequenceNumber
11021102
{
11031103
var payload = (ArraySegment<byte>)entry[ManagementConstants.Properties.Message];
11041104
var amqpMessage = AmqpMessage.CreateAmqpStreamMessage(new BufferListStream(new[] { payload }), true);
1105-
message = AmqpMessageConverter.AmqpMessageToSBMessage(amqpMessage);
1105+
message = AmqpMessageConverter.AmqpMessageToSBMessage(amqpMessage, true);
11061106
messages.Add(message);
11071107
}
11081108

@@ -1523,13 +1523,13 @@ async Task<ReceivingAmqpLink> CreateLinkAsync(TimeSpan timeout)
15231523
var endpointUri = new Uri(this.ServiceBusConnection.Endpoint, this.Path);
15241524
var claims = new[] { ClaimConstants.Listen };
15251525
var amqpSendReceiveLinkCreator = new AmqpSendReceiveLinkCreator(
1526-
this.Path,
1527-
this.ServiceBusConnection,
1528-
endpointUri,
1529-
new string[] { endpointUri.AbsoluteUri },
1530-
claims,
1531-
this.CbsTokenProvider,
1532-
amqpLinkSettings,
1526+
this.Path,
1527+
this.ServiceBusConnection,
1528+
endpointUri,
1529+
new string[] { endpointUri.AbsoluteUri },
1530+
claims,
1531+
this.CbsTokenProvider,
1532+
amqpLinkSettings,
15331533
this.ClientId);
15341534

15351535
Tuple<AmqpObject, DateTime> linkDetails = await amqpSendReceiveLinkCreator.CreateAndOpenAmqpLinkAsync().ConfigureAwait(false);
@@ -1561,13 +1561,13 @@ async Task<RequestResponseAmqpLink> CreateRequestResponseLinkAsync(TimeSpan time
15611561
var endpointUri = new Uri(this.ServiceBusConnection.Endpoint, entityPath);
15621562
string[] claims = { ClaimConstants.Manage, ClaimConstants.Listen };
15631563
var amqpRequestResponseLinkCreator = new AmqpRequestResponseLinkCreator(
1564-
entityPath,
1565-
this.ServiceBusConnection,
1564+
entityPath,
1565+
this.ServiceBusConnection,
15661566
endpointUri,
15671567
new string[] { endpointUri.AbsoluteUri },
1568-
claims,
1569-
this.CbsTokenProvider,
1570-
amqpLinkSettings,
1568+
claims,
1569+
this.CbsTokenProvider,
1570+
amqpLinkSettings,
15711571
this.ClientId);
15721572

15731573
var linkDetails = await amqpRequestResponseLinkCreator.CreateAndOpenAmqpLinkAsync().ConfigureAwait(false);

src/Microsoft.Azure.ServiceBus/Management/ManagementClient.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ public virtual async Task<SubscriptionDescription> CreateSubscriptionAsync(Subsc
634634
/// <summary>
635635
/// Adds a new rule to the subscription under given topic.
636636
/// </summary>
637-
/// <param name="topicName">The topic name relative to the service namespace base address.</param>
637+
/// <param name="topicPath">The topic path relative to the service namespace base address.</param>
638638
/// <param name="subscriptionName">The name of the subscription.</param>
639639
/// <param name="ruleDescription">A <see cref="RuleDescription"/> object describing the attributes with which the messages are matched and acted upon.</param>
640640
/// <param name="cancellationToken"></param>
@@ -646,16 +646,16 @@ public virtual async Task<SubscriptionDescription> CreateSubscriptionAsync(Subsc
646646
/// <exception cref="ServerBusyException">The server is busy. You should wait before you retry the operation.</exception>
647647
/// <exception cref="ServiceBusException">An internal error or unexpected exception occurs.</exception>
648648
/// <returns><see cref="RuleDescription"/> of the recently created rule.</returns>
649-
public virtual async Task<RuleDescription> CreateRuleAsync(string topicName, string subscriptionName, RuleDescription ruleDescription, CancellationToken cancellationToken = default)
649+
public virtual async Task<RuleDescription> CreateRuleAsync(string topicPath, string subscriptionName, RuleDescription ruleDescription, CancellationToken cancellationToken = default)
650650
{
651-
EntityNameHelper.CheckValidTopicName(topicName);
652-
EntityNameHelper.CheckValidSubscriptionName(topicName);
651+
EntityNameHelper.CheckValidTopicName(topicPath);
652+
EntityNameHelper.CheckValidSubscriptionName(subscriptionName);
653653
ruleDescription = ruleDescription ?? throw new ArgumentNullException(nameof(ruleDescription));
654654

655655
var atomRequest = ruleDescription.Serialize().ToString();
656656

657657
var content = await PutEntity(
658-
EntityNameHelper.FormatRulePath(topicName, subscriptionName, ruleDescription.Name),
658+
EntityNameHelper.FormatRulePath(topicPath, subscriptionName, ruleDescription.Name),
659659
atomRequest,
660660
false,
661661
null,

src/Microsoft.Azure.ServiceBus/Management/ManagementClientConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal class ManagementClientConstants
3333
public static readonly TimeSpan MinimumLockDuration = TimeSpan.FromSeconds(5);
3434
public static readonly TimeSpan MaximumLockDuration = TimeSpan.FromMinutes(5);
3535
public static readonly TimeSpan MinimumAllowedAutoDeleteOnIdle = TimeSpan.FromMinutes(5);
36-
public static readonly TimeSpan MaximumDuplicateDetectionHistoryTimeWindow = TimeSpan.FromDays(1);
36+
public static readonly TimeSpan MaximumDuplicateDetectionHistoryTimeWindow = TimeSpan.FromDays(7);
3737
public static readonly TimeSpan MinimumDuplicateDetectionHistoryTimeWindow = TimeSpan.FromSeconds(20);
3838
public static readonly int MinAllowedMaxDeliveryCount = 1;
3939
public static readonly int MaxUserMetadataLength = 1024;

src/Microsoft.Azure.ServiceBus/Management/QueueDescription.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public QueueDescription(string path)
3535
/// <summary>
3636
/// Path of the queue relative to the namespace base address.
3737
/// </summary>
38-
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
38+
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
3939
/// Cannot have restricted characters: '@','?','#','*'</remarks>
4040
public string Path
4141
{
@@ -81,7 +81,7 @@ public TimeSpan LockDuration
8181
/// </summary>
8282
/// <remarks>
8383
/// If true, the receiver can only recieve messages using <see cref="SessionClient.AcceptMessageSessionAsync()"/>.
84-
/// Defaults to false.
84+
/// Defaults to false.
8585
/// </remarks>
8686
public bool RequiresSession { get; set; } = false;
8787

@@ -91,7 +91,7 @@ public TimeSpan LockDuration
9191
/// <remarks>
9292
/// This is the default value used when <see cref="Message.TimeToLive"/> is not set on a
9393
/// message itself. Messages older than their TimeToLive value will expire and no longer be retained in the message store.
94-
/// Subscribers will be unable to receive expired messages.
94+
/// Subscribers will be unable to receive expired messages.
9595
/// Default value is <see cref="TimeSpan.MaxValue"/>.
9696
/// </remarks>
9797
public TimeSpan DefaultMessageTimeToLive
@@ -138,7 +138,7 @@ public TimeSpan AutoDeleteOnIdle
138138
/// The <see cref="TimeSpan"/> duration of duplicate detection history that is maintained by the service.
139139
/// </summary>
140140
/// <remarks>
141-
/// The default value is 1 minute. Max value is 1 day and minimum is 20 seconds.
141+
/// The default value is 1 minute. Max value is 7 days and minimum is 20 seconds.
142142
/// </remarks>
143143
public TimeSpan DuplicateDetectionHistoryTimeWindow
144144
{
@@ -158,7 +158,7 @@ public TimeSpan DuplicateDetectionHistoryTimeWindow
158158
/// <summary>
159159
/// The maximum delivery count of a message before it is dead-lettered.
160160
/// </summary>
161-
/// <remarks>The delivery count is increased when a message is received in <see cref="ReceiveMode.PeekLock"/> mode
161+
/// <remarks>The delivery count is increased when a message is received in <see cref="ReceiveMode.PeekLock"/> mode
162162
/// and didn't complete the message before the message lock expired.
163163
/// Default value is 10. Minimum value is 1.</remarks>
164164
public int MaxDeliveryCount
@@ -206,7 +206,7 @@ internal set
206206
/// <summary>
207207
/// The path of the recipient entity to which all the messages sent to the queue are forwarded to.
208208
/// </summary>
209-
/// <remarks>If set, user cannot manually receive messages from this queue. The destination entity
209+
/// <remarks>If set, user cannot manually receive messages from this queue. The destination entity
210210
/// must be an already existing entity.</remarks>
211211
public string ForwardTo
212212
{

src/Microsoft.Azure.ServiceBus/Management/TopicDescription.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public TopicDescription(string path)
3333
/// <remarks>
3434
/// This is the default value used when <see cref="Message.TimeToLive"/> is not set on a
3535
/// message itself. Messages older than their TimeToLive value will expire and no longer be retained in the message store.
36-
/// Subscribers will be unable to receive expired messages.
36+
/// Subscribers will be unable to receive expired messages.
3737
/// Default value is <see cref="TimeSpan.MaxValue"/>.
3838
/// </remarks>
3939
public TimeSpan DefaultMessageTimeToLive
@@ -88,7 +88,7 @@ public TimeSpan AutoDeleteOnIdle
8888
/// The <see cref="TimeSpan"/> duration of duplicate detection history that is maintained by the service.
8989
/// </summary>
9090
/// <remarks>
91-
/// The default value is 1 minute. Max value is 1 day and minimum is 20 seconds.
91+
/// The default value is 1 minute. Max value is 7 days and minimum is 20 seconds.
9292
/// </remarks>
9393
public TimeSpan DuplicateDetectionHistoryTimeWindow
9494
{
@@ -108,7 +108,7 @@ public TimeSpan DuplicateDetectionHistoryTimeWindow
108108
/// <summary>
109109
/// Path of the topic relative to the namespace base address.
110110
/// </summary>
111-
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
111+
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
112112
/// Cannot have restricted characters: '@','?','#','*'</remarks>
113113
public string Path
114114
{
@@ -153,8 +153,8 @@ internal set
153153
public bool EnablePartitioning { get; set; } = false;
154154

155155
/// <summary>
156-
/// Defines whether ordering needs to be maintained. If true, messages sent to topic will be
157-
/// forwarded to the subscription in order.
156+
/// Defines whether ordering needs to be maintained. If true, messages sent to topic will be
157+
/// forwarded to the subscription in order.
158158
/// </summary>
159159
/// <remarks>Defaults to false.</remarks>
160160
public bool SupportOrdering { get; set; } = false;
@@ -190,7 +190,7 @@ public string UserMetadata
190190

191191
/// <summary>
192192
/// List of properties that were retrieved using GetTopic but are not understood by this version of client is stored here.
193-
/// The list will be sent back when an already retrieved TopicDescription will be used in UpdateTopic call.
193+
/// The list will be sent back when an already retrieved TopicDescription will be used in UpdateTopic call.
194194
/// </summary>
195195
internal List<object> UnknownProperties { get; set; }
196196

@@ -207,7 +207,7 @@ public override bool Equals(object obj)
207207

208208
public bool Equals(TopicDescription otherDescription)
209209
{
210-
if (otherDescription is TopicDescription other
210+
if (otherDescription is TopicDescription other
211211
&& this.Path.Equals(other.Path, StringComparison.OrdinalIgnoreCase)
212212
&& this.AutoDeleteOnIdle.Equals(other.AutoDeleteOnIdle)
213213
&& this.DefaultMessageTimeToLive.Equals(other.DefaultMessageTimeToLive)

src/Microsoft.Azure.ServiceBus/Microsoft.Azure.ServiceBus.csproj

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
<PropertyGroup>
44
<Description>This is the next generation Azure Service Bus .NET Standard client library that focuses on queues &amp; topics. For more information about Service Bus, see https://azure.microsoft.com/en-us/services/service-bus/</Description>
5-
<Version>3.1.1</Version>
5+
<Version>3.2.0</Version>
66
<Authors>Microsoft</Authors>
77
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
8-
<TargetFramework>netstandard2.0</TargetFramework>
8+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
99
<AssemblyOriginatorKeyFile>../../build/keyfile.snk</AssemblyOriginatorKeyFile>
1010
<SignAssembly>true</SignAssembly>
1111
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
@@ -15,6 +15,9 @@
1515
<PackageProjectUrl>https://github.com/Azure/azure-service-bus-dotnet</PackageProjectUrl>
1616
<PackageLicenseUrl>https://raw.githubusercontent.com/Azure/azure-service-bus-dotnet/master/LICENSE</PackageLicenseUrl>
1717
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
18+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
19+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
20+
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
1821
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1922
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
2023
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
@@ -26,15 +29,16 @@
2629
<ItemGroup>
2730
<PackageReference Include="Microsoft.Azure.Amqp" Version="[2.3.5, 3.0.0)" />
2831
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="[1.0.1, 2.0.0)" />
29-
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="[3.17.2, 4.0.0)" />
32+
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="[3.17.2, 5.0.0)" />
3033
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.4.1" />
3134
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="[5.2.2, 6.0.0)" />
35+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
3236
</ItemGroup>
3337

34-
<ItemGroup Label="SourceLink to embed PDBs with the assembly">
35-
<PackageReference Include="SourceLink.Create.GitHub" Version="2.8.3" PrivateAssets="All" />
36-
<PackageReference Include="SourceLink.Copy.PdbFiles" Version="2.8.3" PrivateAssets="All" />
37-
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.3" />
38+
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
39+
<Reference Include="System.Transactions" />
40+
<Reference Include="System.Net.Http" />
41+
<Reference Include="System.Web" />
3842
</ItemGroup>
3943

4044
<ItemGroup>

src/Microsoft.Azure.ServiceBus/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Microsoft.Azure.ServiceBus/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@
159159
<data name="TokenMissingExpiresOn" xml:space="preserve">
160160
<value>The provided token does not specify the 'ExpiresOn' value.</value>
161161
</data>
162+
<data name="ListOfLockTokensCannotBeEmpty" xml:space="preserve">
163+
<value>List of lock tokens cannot be empty</value>
164+
</data>
162165
<data name="NotSupportedPropertyType" xml:space="preserve">
163166
<value>'{0}' is not a supported type.</value>
164167
</data>

0 commit comments

Comments
 (0)