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

Commit

Permalink
Merge pull request #608 from Azure/dev
Browse files Browse the repository at this point in the history
Release 3.2.0
  • Loading branch information
nemakam authored Nov 27, 2018
2 parents b9ae045 + 47307b6 commit 9b22eab
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 62 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,3 @@ In order to run the unit tests, you will need to do the following:
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.**

Once you have completed the above, you can run `dotnet test` from the `/test/Microsoft.Azure.ServiceBus.UnitTests` directory.

### Can I manage Service Bus entities with this library?

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.

* 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)
* NuGet package - [https://www.nuget.org/packages/Microsoft.Azure.Management.ServiceBus/](https://www.nuget.org/packages/Microsoft.Azure.Management.ServiceBus/)
* Sample - [https://github.com/Azure-Samples/service-bus-dotnet-management](https://github.com/Azure-Samples/service-bus-dotnet-management)
4 changes: 2 additions & 2 deletions src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static AmqpMessage SBMessageToAmqpMessage(SBMessage sbMessage)
return amqpMessage;
}

public static SBMessage AmqpMessageToSBMessage(AmqpMessage amqpMessage)
public static SBMessage AmqpMessageToSBMessage(AmqpMessage amqpMessage, bool isPeeked = false)
{
if (amqpMessage == null)
{
Expand Down Expand Up @@ -229,7 +229,7 @@ public static SBMessage AmqpMessageToSBMessage(AmqpMessage amqpMessage)

if (amqpMessage.Header.DeliveryCount != null)
{
sbMessage.SystemProperties.DeliveryCount = (int)(amqpMessage.Header.DeliveryCount.Value + 1);
sbMessage.SystemProperties.DeliveryCount = isPeeked ? (int)(amqpMessage.Header.DeliveryCount.Value) : (int)(amqpMessage.Header.DeliveryCount.Value + 1);
}
}

Expand Down
32 changes: 16 additions & 16 deletions src/Microsoft.Azure.ServiceBus/Core/MessageReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public MessageReceiver(
{
throw Fx.Exception.ArgumentNullOrWhiteSpace(connectionString);
}

this.OwnsConnection = true;
}

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

if (string.IsNullOrWhiteSpace(entityPath))
Expand Down Expand Up @@ -512,7 +512,7 @@ public async Task CompleteAsync(IEnumerable<string> lockTokens)
var lockTokenList = lockTokens.ToList();
if (lockTokenList.Count == 0)
{
throw Fx.Exception.ArgumentNull(nameof(lockTokens));
throw Fx.Exception.Argument(nameof(lockTokens), Resources.ListOfLockTokensCannotBeEmpty);
}

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

Expand Down Expand Up @@ -1523,13 +1523,13 @@ async Task<ReceivingAmqpLink> CreateLinkAsync(TimeSpan timeout)
var endpointUri = new Uri(this.ServiceBusConnection.Endpoint, this.Path);
var claims = new[] { ClaimConstants.Listen };
var amqpSendReceiveLinkCreator = new AmqpSendReceiveLinkCreator(
this.Path,
this.ServiceBusConnection,
endpointUri,
new string[] { endpointUri.AbsoluteUri },
claims,
this.CbsTokenProvider,
amqpLinkSettings,
this.Path,
this.ServiceBusConnection,
endpointUri,
new string[] { endpointUri.AbsoluteUri },
claims,
this.CbsTokenProvider,
amqpLinkSettings,
this.ClientId);

Tuple<AmqpObject, DateTime> linkDetails = await amqpSendReceiveLinkCreator.CreateAndOpenAmqpLinkAsync().ConfigureAwait(false);
Expand Down Expand Up @@ -1561,13 +1561,13 @@ async Task<RequestResponseAmqpLink> CreateRequestResponseLinkAsync(TimeSpan time
var endpointUri = new Uri(this.ServiceBusConnection.Endpoint, entityPath);
string[] claims = { ClaimConstants.Manage, ClaimConstants.Listen };
var amqpRequestResponseLinkCreator = new AmqpRequestResponseLinkCreator(
entityPath,
this.ServiceBusConnection,
entityPath,
this.ServiceBusConnection,
endpointUri,
new string[] { endpointUri.AbsoluteUri },
claims,
this.CbsTokenProvider,
amqpLinkSettings,
claims,
this.CbsTokenProvider,
amqpLinkSettings,
this.ClientId);

var linkDetails = await amqpRequestResponseLinkCreator.CreateAndOpenAmqpLinkAsync().ConfigureAwait(false);
Expand Down
10 changes: 5 additions & 5 deletions src/Microsoft.Azure.ServiceBus/Management/ManagementClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public virtual async Task<SubscriptionDescription> CreateSubscriptionAsync(Subsc
/// <summary>
/// Adds a new rule to the subscription under given topic.
/// </summary>
/// <param name="topicName">The topic name relative to the service namespace base address.</param>
/// <param name="topicPath">The topic path relative to the service namespace base address.</param>
/// <param name="subscriptionName">The name of the subscription.</param>
/// <param name="ruleDescription">A <see cref="RuleDescription"/> object describing the attributes with which the messages are matched and acted upon.</param>
/// <param name="cancellationToken"></param>
Expand All @@ -646,16 +646,16 @@ public virtual async Task<SubscriptionDescription> CreateSubscriptionAsync(Subsc
/// <exception cref="ServerBusyException">The server is busy. You should wait before you retry the operation.</exception>
/// <exception cref="ServiceBusException">An internal error or unexpected exception occurs.</exception>
/// <returns><see cref="RuleDescription"/> of the recently created rule.</returns>
public virtual async Task<RuleDescription> CreateRuleAsync(string topicName, string subscriptionName, RuleDescription ruleDescription, CancellationToken cancellationToken = default)
public virtual async Task<RuleDescription> CreateRuleAsync(string topicPath, string subscriptionName, RuleDescription ruleDescription, CancellationToken cancellationToken = default)
{
EntityNameHelper.CheckValidTopicName(topicName);
EntityNameHelper.CheckValidSubscriptionName(topicName);
EntityNameHelper.CheckValidTopicName(topicPath);
EntityNameHelper.CheckValidSubscriptionName(subscriptionName);
ruleDescription = ruleDescription ?? throw new ArgumentNullException(nameof(ruleDescription));

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

var content = await PutEntity(
EntityNameHelper.FormatRulePath(topicName, subscriptionName, ruleDescription.Name),
EntityNameHelper.FormatRulePath(topicPath, subscriptionName, ruleDescription.Name),
atomRequest,
false,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class ManagementClientConstants
public static readonly TimeSpan MinimumLockDuration = TimeSpan.FromSeconds(5);
public static readonly TimeSpan MaximumLockDuration = TimeSpan.FromMinutes(5);
public static readonly TimeSpan MinimumAllowedAutoDeleteOnIdle = TimeSpan.FromMinutes(5);
public static readonly TimeSpan MaximumDuplicateDetectionHistoryTimeWindow = TimeSpan.FromDays(1);
public static readonly TimeSpan MaximumDuplicateDetectionHistoryTimeWindow = TimeSpan.FromDays(7);
public static readonly TimeSpan MinimumDuplicateDetectionHistoryTimeWindow = TimeSpan.FromSeconds(20);
public static readonly int MinAllowedMaxDeliveryCount = 1;
public static readonly int MaxUserMetadataLength = 1024;
Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.Azure.ServiceBus/Management/QueueDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public QueueDescription(string path)
/// <summary>
/// Path of the queue relative to the namespace base address.
/// </summary>
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
/// Cannot have restricted characters: '@','?','#','*'</remarks>
public string Path
{
Expand Down Expand Up @@ -81,7 +81,7 @@ public TimeSpan LockDuration
/// </summary>
/// <remarks>
/// If true, the receiver can only recieve messages using <see cref="SessionClient.AcceptMessageSessionAsync()"/>.
/// Defaults to false.
/// Defaults to false.
/// </remarks>
public bool RequiresSession { get; set; } = false;

Expand All @@ -91,7 +91,7 @@ public TimeSpan LockDuration
/// <remarks>
/// This is the default value used when <see cref="Message.TimeToLive"/> is not set on a
/// message itself. Messages older than their TimeToLive value will expire and no longer be retained in the message store.
/// Subscribers will be unable to receive expired messages.
/// Subscribers will be unable to receive expired messages.
/// Default value is <see cref="TimeSpan.MaxValue"/>.
/// </remarks>
public TimeSpan DefaultMessageTimeToLive
Expand Down Expand Up @@ -138,7 +138,7 @@ public TimeSpan AutoDeleteOnIdle
/// The <see cref="TimeSpan"/> duration of duplicate detection history that is maintained by the service.
/// </summary>
/// <remarks>
/// The default value is 1 minute. Max value is 1 day and minimum is 20 seconds.
/// The default value is 1 minute. Max value is 7 days and minimum is 20 seconds.
/// </remarks>
public TimeSpan DuplicateDetectionHistoryTimeWindow
{
Expand All @@ -158,7 +158,7 @@ public TimeSpan DuplicateDetectionHistoryTimeWindow
/// <summary>
/// The maximum delivery count of a message before it is dead-lettered.
/// </summary>
/// <remarks>The delivery count is increased when a message is received in <see cref="ReceiveMode.PeekLock"/> mode
/// <remarks>The delivery count is increased when a message is received in <see cref="ReceiveMode.PeekLock"/> mode
/// and didn't complete the message before the message lock expired.
/// Default value is 10. Minimum value is 1.</remarks>
public int MaxDeliveryCount
Expand Down Expand Up @@ -206,7 +206,7 @@ internal set
/// <summary>
/// The path of the recipient entity to which all the messages sent to the queue are forwarded to.
/// </summary>
/// <remarks>If set, user cannot manually receive messages from this queue. The destination entity
/// <remarks>If set, user cannot manually receive messages from this queue. The destination entity
/// must be an already existing entity.</remarks>
public string ForwardTo
{
Expand Down
14 changes: 7 additions & 7 deletions src/Microsoft.Azure.ServiceBus/Management/TopicDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public TopicDescription(string path)
/// <remarks>
/// This is the default value used when <see cref="Message.TimeToLive"/> is not set on a
/// message itself. Messages older than their TimeToLive value will expire and no longer be retained in the message store.
/// Subscribers will be unable to receive expired messages.
/// Subscribers will be unable to receive expired messages.
/// Default value is <see cref="TimeSpan.MaxValue"/>.
/// </remarks>
public TimeSpan DefaultMessageTimeToLive
Expand Down Expand Up @@ -88,7 +88,7 @@ public TimeSpan AutoDeleteOnIdle
/// The <see cref="TimeSpan"/> duration of duplicate detection history that is maintained by the service.
/// </summary>
/// <remarks>
/// The default value is 1 minute. Max value is 1 day and minimum is 20 seconds.
/// The default value is 1 minute. Max value is 7 days and minimum is 20 seconds.
/// </remarks>
public TimeSpan DuplicateDetectionHistoryTimeWindow
{
Expand All @@ -108,7 +108,7 @@ public TimeSpan DuplicateDetectionHistoryTimeWindow
/// <summary>
/// Path of the topic relative to the namespace base address.
/// </summary>
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
/// <remarks>Max length is 260 chars. Cannot start or end with a slash.
/// Cannot have restricted characters: '@','?','#','*'</remarks>
public string Path
{
Expand Down Expand Up @@ -153,8 +153,8 @@ internal set
public bool EnablePartitioning { get; set; } = false;

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

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

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

public bool Equals(TopicDescription otherDescription)
{
if (otherDescription is TopicDescription other
if (otherDescription is TopicDescription other
&& this.Path.Equals(other.Path, StringComparison.OrdinalIgnoreCase)
&& this.AutoDeleteOnIdle.Equals(other.AutoDeleteOnIdle)
&& this.DefaultMessageTimeToLive.Equals(other.DefaultMessageTimeToLive)
Expand Down
18 changes: 11 additions & 7 deletions src/Microsoft.Azure.ServiceBus/Microsoft.Azure.ServiceBus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<PropertyGroup>
<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>
<Version>3.1.1</Version>
<Version>3.2.0</Version>
<Authors>Microsoft</Authors>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<AssemblyOriginatorKeyFile>../../build/keyfile.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
Expand All @@ -15,6 +15,9 @@
<PackageProjectUrl>https://github.com/Azure/azure-service-bus-dotnet</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/Azure/azure-service-bus-dotnet/master/LICENSE</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
Expand All @@ -26,15 +29,16 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Amqp" Version="[2.3.5, 3.0.0)" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="[1.0.1, 2.0.0)" />
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="[3.17.2, 4.0.0)" />
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="[3.17.2, 5.0.0)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.4.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="[5.2.2, 6.0.0)" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Label="SourceLink to embed PDBs with the assembly">
<PackageReference Include="SourceLink.Create.GitHub" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="SourceLink.Copy.PdbFiles" Version="2.8.3" PrivateAssets="All" />
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.3" />
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<Reference Include="System.Transactions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Web" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions src/Microsoft.Azure.ServiceBus/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Microsoft.Azure.ServiceBus/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
<data name="TokenMissingExpiresOn" xml:space="preserve">
<value>The provided token does not specify the 'ExpiresOn' value.</value>
</data>
<data name="ListOfLockTokensCannotBeEmpty" xml:space="preserve">
<value>List of lock tokens cannot be empty</value>
</data>
<data name="NotSupportedPropertyType" xml:space="preserve">
<value>'{0}' is not a supported type.</value>
</data>
Expand Down
Loading

0 comments on commit 9b22eab

Please sign in to comment.