Граф коммитов

305 Коммитов

Автор SHA1 Сообщение Дата
Neeraj Makam e693fa6ce3
[WIP] Transaction support (#421)
Introduces transaction support.
Operations can now be executed inside a TransactionScope providing atomicity.
Supported operations for transactions:
`SendAsync`, `CompleteAsync`, `DeferAsync`, `DeadLetterAsync`, `AbandonAsync`

Transaction cannot work across connections. Hence, to be able to Send and Receive in a single transaction, `ServiceBusConnection` object has been exposed. Each of the client entities now accepts an already created connection.

Sample usage:
```csharp
var connection = new ServiceBusConnection(ConnectionString);
var sender = new MessageSender(connection, QueueName);
var receiver = new MessageReceiver(connection, QueueName);
var receivedMessage = await receiver.ReceiveAsync();

using (var ts = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
	await receiver.CompleteAsync(receivedMessage.SystemProperties.LockToken);
	await sender.SendAsync(message).ConfigureAwait(false);
	ts.Complete();
        // Or, ts.Dispose();
}

await sender.CloseAsync();
await receiver.CloseAsync();
await connection.CloseAsync();
```
2018-03-29 19:38:05 -07:00
Sean Feldman 61948293c7 Add a range to AMQP dependency package (#434)
Fixes #432 (Microsoft.Azure.Amqp tight to a specific version).

* Add a range to AMQP dependency package
* Add range for Microsoft.IdentityModel.Clients.ActiveDirectory
2018-03-26 12:13:06 -07:00
Neeraj Makam 90ce19dd89
Merge branch 'master' into dev 2018-02-21 16:14:33 -08:00
Neeraj Makam 2c375aeb08
Adding MessageSizeExceededException (#422)
Resolves #356
2018-02-21 16:09:33 -08:00
Michael Scrivo b321e370fa Messages with no TTL now correctly get default TTL (#425)
If you don't set a TTL on a message, it gets a value of TimeSpan.MaxValue.
The code that converts it to an Ampq message was checking whether
message.TimeToLive was null rather than if it was equal to TimeSpan.MaxValue.
Now, if it's equal to TimeSpan.MaxValue, it will use the Default value
set on the Entity.

This fixes #424
2018-02-21 13:59:03 -08:00
Vijaya Gopal Yarramneni 4daa663606 Adding associatedlinkname application property to request-response (#420)
* Adding associatedlinkname application property to request-response requests so that they can be associated with proper publisher or consumer on the service.
* Changing ReceiveLinkManager access from protected to internal
2018-02-13 14:50:05 -08:00
Neeraj Makam dd56c4fc24
Updating to latest references + minor fixes (#396)
1. Updated references to latest amqp and other packages. #336 
1. Updated resource string for exception. #375 
1. Added retry logic for cbs token renewal to make it more resilient to network issues. #378 
1. Updated bug where `CbsTokenProvider` was not initialized properly.  #359 (Thanks @Aleksanderis)
1. Support for custom token providers which was added for few clients has been extended to `MessageSender`, `MessageReceiver` and `SessionClient`
1. Minor cleanup.
2018-02-12 18:34:07 -08:00
Sean Feldman 1db236d5bb Message tostring issue 407 (#408)
Fixes #407 by replacing string interpolation with regular string.Format() and CultureInfo.CurrentCulture.

Added unit test to cover a few scenarios, including no message ID.
2018-01-19 17:20:52 -08:00
Christian Wolf 2dd55f56ea Newlogo (#401)
Changing Display logo
2018-01-10 18:46:07 -08:00
vinaysurya df83179e19
Merge pull request #394 from Azure/dev
Merge dev branch to master for 3.0 preview release
2017-12-15 16:59:28 -08:00
vinaysurya a51efe26a2
Merge branch 'master' into dev 2017-12-15 12:15:16 -08:00
Vinay Suryanarayana ec375f5af2 Minor update to release version 2017-12-15 12:08:54 -08:00
vinaysurya 8aeff6f249
Update release version and minot nit spell correction on comments (#392) 2017-12-15 11:28:42 -08:00
Sean Feldman df89b97896 Bump dependencies to support ApiApprovals for .NETStandard (#377)
* using xunit compatible reporter

* filtering TargetFrameworkAttribute assembly attribute as it's framework specific

* no longer including TargetFrameworkAttribute in the approved API

* update dependencies for test project

* Moving reporter configuration to a separate file
2017-12-15 04:34:41 -08:00
vinaysurya e1bd055cf2
Fix ObjectDisposedException when reveiver is Closed or when the Cancellation tokens are disposed (#390) 2017-12-15 03:20:36 -08:00
vinaysurya d5193227ca
Fixdevbranch test execution -2 (#391)
* Reduce checkin tests execution time so build jobs on appveyor can complete

* Addressing Review Comments, moved the conditional complile to the test proj file

* Use .netcoreapp framework instead of .netstandard framework

* Remove Diagnostic Tests as well

* Trying to fix a flaky test

* Disable the flaky Test

* Disable and another flaky test
2017-12-15 02:29:08 -08:00
vinaysurya 101a5c776f
Reduce checkin tests execution time so build jobs on appveyor can complete (#389)
* Reduce checkin tests execution time so build jobs on appveyor can complete

* Addressing Review Comments, moved the conditional complile to the test proj file

* Use .netcoreapp framework instead of .netstandard framework

* Remove Diagnostic Tests as well
2017-12-14 20:54:28 -08:00
Serkant Karaca 4e1512810d Wiring up AAD token providers to messaging client (#385)
* Wiring up AAD token providers

* Addressing Vinay's comments.

* Build failure fix

* Removing extra overloads.

* Remove unnecessary default internal constructor in SecurityToken

* Pass temporary audience instead of empty string to SecurityToken.

* Make token type required

* Refactoring SharedAccessSignatureToken for cleanup

* Remove unnecessary usings

* Function renaming to carry UTC notion.

* Changes for ApiApproval

* Remove procted accesors from SecurityToken class properties.

* ApiApproval run after moving fields to private.
2017-12-13 18:55:26 -08:00
Darryl Shpak 560ed609c9 Expose public constructors on exception classes (#374)
Fixes #373. This makes the constructors for exception classes public, so that when interfaces such as IQueueClient are mocked for unit testing, the mocks can throw the correct exceptions.
2017-11-10 11:00:12 -08:00
Liudmila Molkova dc40924e49 Instruments operations on ServiceBus with DiagnosticsSource and introduces correlation between producer and consumer (#370)
This change adds instrumentation with `DiagnosticSource` for public ServiceBus APIs:
- `MessageSender` (i.e. `QueueClient` and `TopicClient`): `SendAsync`, `ScueduleMessage` and `Cancel`
- `MessageReceiver`: `Receive`, `ReceiveDeffered`, `Peek`, `Abandon`, `Defer`, `Complete`, `DeadLetter`, `RenewLock`
- `MessageSession`: `AcceptMessageSession`
- `SubscriptionClient` : `AddRule`, `RemoveRule`, `GetRules`
- Message and session handlers

Tracing system (e.g. ApplicationInsights) may subscribe to ServiceBus DiagnosticSource and receive events about these operations including tracing context needed to correlate events and log any important information.

In absence of tracing system, diagnostics is disabled and performance cost of having it is ~zero.

We also introduce here telemetry correlation between producer and consumer: when diagnostics is enabled on a consumer, tracing context is injected into the message. When a producer receives such message, it extracts and restores context making it available for tracing system.

This also adds `Message.ExtractActivity()` public extension method that allows extracting the context from a message that is useful when handler API is NOT used to process messages.

Note: this change introduces 'standard' fields to pass tracing context through the queues to correlate telemetry:
`Diagnostic-Id` - uniquely identifies operation that sent message(s) to the queue
`Correlation-Context` - optional extended context (empty by default)

This is pretty similar to [HTTP Correlation protocol](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md) implemented in .NET HTTP stack.

Users are encouraged to use these properties on all platforms, not only .NET. 

As a result of this change, a tracing system may enable diagnostics information and receive events it's interested in making sure tracing context is propagated through the service bus, without ANY changes in user code (except for non-handler processing).

-------

Instrumentation approach backgound:
-  [Activity UserGuide](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md)
- [DiagnosticSource UserGuide](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md)
- [.NET HTTP Client instrumentation](https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/HttpDiagnosticsGuide.md)
- [HTTP Correlation protocol](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md)
- [EventHub .NET Client instrumentation (WIP)](8f934200e9)
2017-11-07 19:50:27 -08:00
Neeraj Makam 41561149a5 Updated inline comments for message properties (#349)
Updated the XML comments for message properties to align with the newly published docs.
2017-10-25 14:22:51 -07:00
clemensv 602b1fbcc7 Wording for SequenceNumber updated. 2017-10-25 14:53:54 +02:00
clemensv e654b53c31 Merge branch 'dev' of http://github.com/clemensv/azure-service-bus-dotnet into dev 2017-10-25 14:08:23 +02:00
clemensv b93e16ce92 Merge branch 'dev' of https://github.com/azure/azure-service-bus-dotnet into dev 2017-10-25 14:07:20 +02:00
Neeraj Makam 2f631fee94 Using PublicApiGenerator nuget (#350)
Fixes #315
2017-10-13 11:27:21 -07:00
Sean Feldman 7cacc60321 lock version 2017-10-12 19:14:41 -06:00
Neeraj Makam 18bc48b7b8 Merge branch 'dev' into api-approver-update 2017-10-12 15:08:29 -07:00
Neeraj Makam 87148d79cd Merge pull request #355 from Azure/dev
https://github.com/Azure/azure-service-bus-dotnet/milestone/8?closed=1 contains items being shipped with 2.0 release
2017-10-12 13:44:07 -07:00
Neeraj Makam 1abea93789 Merge branch 'master' into dev 2017-10-12 12:10:37 -07:00
Neeraj Makam 4ad09fe2e4 Revert "Release 2.0.0 (#352)" (#354)
This reverts commit 890c0468de.
2017-10-12 12:09:09 -07:00
Neeraj Makam 890c0468de Release 2.0.0 (#352)
https://github.com/Azure/azure-service-bus-dotnet/milestone/8?closed=1 contains items being shipped with 2.0 release
2017-10-12 12:05:48 -07:00
Sean Feldman 15328cca1f Lock PublicApiGenerator on stable and remove its dependency from csproj 2017-10-10 14:31:19 -06:00
Sean Feldman 1c0c060751 White listing ASB 2017-10-10 14:31:19 -06:00
Sean Feldman d1341b4cd2 use the latest ApiApprovals - remove the need to use local copied code 2017-10-10 14:31:18 -06:00
Sean Feldman 43723e2add Inlined variables (#342) 2017-10-10 11:16:55 -07:00
Clemens Vasters cf655dbf1f Merge branch 'dev' into dev 2017-10-10 11:05:31 +02:00
Clemens Vasters 6eb4546175 Updated comments. 2017-10-10 10:56:23 +02:00
Neeraj Makam 9cfbdf25ac Removing filtering of expired messages from `ReceiveAsync()` (#351)
We had logic written in MessageReceiver.ReceiveAsync() to filter out expired messages before returning the message to the user. This might lead to problems when there is a machine time difference between the ASB service and the client machine which may lead to never receiving a message.
Removing this "smart" handling of expired messages.
If the prefetch count is high, customers can receive messages from the prefetched queue which are already expired. This also helps customers in calculating the optimal prefetch count. If they receive expired messages, then the prefetch count needs to be re-looked at.
2017-10-09 18:32:00 -07:00
clemensv 22347ec7bf Merge branch 'dev' of https://github.com/azure/azure-service-bus-dotnet into dev 2017-10-09 09:05:17 +02:00
clemensv 963e1740fe Updated inline comments for message properties 2017-10-09 09:04:43 +02:00
Neeraj Makam 468d02fd16 Minor fixes (#347)
* Fixing issue #329. Adding missing param
* Fixing comments in #341
* Reducing test flakiness for WaitingReceiveShouldThrowWhenReceiverIsClosed
* Fixes issue #312
2017-10-06 19:25:12 -07:00
Neeraj Makam 9436ad947f Added additional overloads for deadletter/abandon/defer (#341)
* Added overload for deadletterAsync to specify dead letter reason
* Added overload for deadletter/abandon/defer to take properties that needs to be updated.
Resolves #339
2017-10-04 17:56:08 -07:00
Clemens Vasters 50b56c0961 Merge pull request #338 from clemensv/dev
Added SharedAccessSignature support for Connection String
2017-10-02 19:43:56 +02:00
Clemens Vasters 442973d422 Added ctrs to approvals list 2017-10-02 16:07:01 +02:00
clemensv 5a3e8ff5d3 Added SharedSignatureSupport for Connection String 2017-09-29 17:54:36 +02:00
Neeraj Makam 133cc92052 Updating version changes that were missed out (#334) 2017-09-22 15:11:07 -07:00
Neeraj Makam 4012c45a71 Updating version to 2.0 (#331)
Updating client version to 2.0 since we have a breaking change (Interface changes in IMessageReceiver)
Bumping up dotnet framework version to netstandard 2.0. net 46 is required for functioning of web sockets
2017-09-21 18:23:42 -07:00
Neeraj Makam e2261707db Handling receiver.Close and clientEntity.IsClosedOrClosing (#330)
1. #258 - Pending Receiver.Receive should throw when the receiver is closed.
2. #297 - ClientEntity.IsClosedOrClosing should be thread safe (locking)
2017-09-19 16:10:45 -07:00
Simon Cropp 10fb579c96 cleanup v4 (#324)
* guard against empty string params
fixes #318
* remove redundant doco
fixes #319
* supress CS1573
* remove some redundant state machines
* Update QueueClient.cs
2017-09-18 12:49:54 -07:00
Neeraj Makam f9b0e63caf Closing amqp-session when creating link fails. (#325)
We create a new amqp-session on which we open links. But if link creation fails, we should close the session as it is not re-used again. These sessions are mapped to a session handle table on backend which keeps track of these open sessions. Once we hit 5000 open sessions, backend throws QuotaExceededException.
Fixes #237
2017-09-18 11:03:30 -07:00