You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 12, 2023. It is now read-only.
Add support for configuring OperationTimeout in the connection string (#644)
* Add support for configuring OperationTimeout in the connection string
Like in [Microsoft.ServiceBus.Messaging (.NET Framework)][1], it's now possible to configure the `OperationTimeout` in the connection string.
The `ServiceBusConnection` class constructors are adapted to read the `OperationTimeout` from the connection string and the constructor explicitly having a `TimeSpan operationTimeout` argument is obsoleted with this message:
> Please use the constructor with (string namespaceConnectionString, RetryPolicy retryPolicy) arguments and define the operationTimeout in the connection string.
[1]: https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.servicebusconnectionstringbuilder.operationtimeout
* Use the operation timeout defined in the connection string for the ManagementClient
Also, **actually** use the operation timeout as a timeout for the `HttpClient` responsible for the management operations instead of storing the `Constants.DefaultOperationTimeout` in a private field which is never used.
* Update API Approvals
* Always append key value pair delimiter when building the connection string
* Improve wording as suggested by @SeanFeldman
* Improve operation timeout parsing
Parse as int (seconds) first, fallback on TimeSpan parsing for compatibility with WindowsAzure.ServiceBus.
* Throw if the operation timeout input is neither parsable as int or TimeSpan.
* Throw if the operation timeout is smaller than or equal to zero.
* Throw if the operation timeout is greater than or equal to one hour.
/// <param name="operationTimeout">Duration after which individual operations will timeout.</param>
49
72
/// <param name="retryPolicy">Retry policy for operations. Defaults to <see cref="RetryPolicy.Default"/></param>
50
73
/// <remarks>It is the responsibility of the user to close the connection after use through <see cref="CloseAsync"/></remarks>
74
+
[Obsolete("This constructor is obsolete. Use ServiceBusConnection(string namespaceConnectionString, RetryPolicy retryPolicy) constructor instead, providing operationTimeout in the connection string.")]
throwFx.Exception.Argument(nameof(connectionString),$"The {OperationTimeoutConfigName} ({value}) format is invalid. It must be an integer representing a number of seconds.");
349
+
}
350
+
351
+
if(this.OperationTimeout.TotalMilliseconds<=0)
352
+
{
353
+
throwFx.Exception.Argument(nameof(connectionString),$"The {OperationTimeoutConfigName} ({value}) must be greater than zero.");
354
+
}
355
+
356
+
if(this.OperationTimeout.TotalHours>=1)
357
+
{
358
+
throwFx.Exception.Argument(nameof(connectionString),$"The {OperationTimeoutConfigName} ({value}) must be smaller than one hour.");
0 commit comments