The various manager APIs all had their own error handling code, which would result in them occasionally obscuring the actual HTTP response error.
We're now respecting the HTTP status codes and anything >= 400 causes us to fail with an actual error with text, rather than an empty error.
Fixes#229
Make it so we use a single management link (most of the time) when doing dispositions or lock renewal (or other management related operations).
Also, added in a simple stress test. It's a bit manual at the moment, but it initiates 1000 concurrent renew lock calls at once, so it's a decent test of our response routing.
* defer close the link!
* nicer wrapping
* fold error handling to avoid variable shadowing and make scopes clearer
* fix return
* revert to simplest change possible
Updating go.mod to use latest version of go-amqp (with fix in https://github.com/Azure/go-amqp/pull/43) to fix an issue with deferring messages.
When we were sending sequence numbers (via properties) in the message they would be serialized incorrectly since the code was downsizing the type to an int8 without doing proper limit checking. This would result in us sending "negative" sequence numbers.
The customer saw this with a dead letter queue (as did I) but I think that was just a coincidence - it should happen with any 'int64 array' properties.
Fixes#241
The current implementation that lists resources (using ATOM) doesn't allow passing in skip, which would allow you to list more than the default page size of 100 items.
This PR adds in skip (and top, which controls the size of the page) for listing queues, topics and subscriptions which allows you, over multiple calls and incrementing skip, to get the list of all entities.
Fixes#231
By default, Service Bus's ATOM API will return 100 items in a single page. Top and skip allow you to continue paging through any additional items beyond those first set, as well as controlling the number of entries that are retrieved at a time.
Also, adding in tests.
Propagate the session ID selected by the broker when a nil session ID is
specified. This requires an updated go-amqp to work.
Removed validation of EnqueuedSequenceNumber as it's not guaranteed to
be returned.
* Add associated-link-name property to RenewLocks message. Fix connection idle timeout for messages with >=10minsprocessing time.
* Upgrade go-amqp
* Make message.getLinkName package level function
* only set associated link name if available
Co-authored-by: Robert Zakrzewski <Robert.Zakrzewski@tomtom.com>
Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
* prove faster lock proof
amqp now takes message dispostion into account to adjust the flow
this means that no credits are provided to the sender
until a disposition is sent for a given message.
previous test handled messages concurrently without completing them
and this won't work anymore, unless the prefetch is set higher.
* fix gofmt
* add MIT header
* bump go-amqp and switch to t.Logf()
Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
* Add recovery mechanism to rpcClient
RPC operations will now attempt to recover, similar to sender and
receiver, in case of failure.
Fixed Recover() to atomically rebuild the client.
Close() will now close auth auto-refresh.
* add transient error checks
* don't recover on a closed connection
use common.Retry() for Recover() retry loop
added recovery tracing and debug logging
* improve some doc comments
* avoid potential for infinite loop
* Consolidate auth auto-refresh
Moved the enabling of auth auto-refresh to when calling
negotiateClaim(). This ensures that all code paths that require
authentication will enable auto-refresh.
Ensure that there's only one goroutine that performs the refresh.
Changed auth refresh interval to 15 minutes per guideance from SB.
Exit auth auto-refresh goroutine if it fails; this should help trigger
recovering of clients due to failed authentication.
* cancel auth when closing RPC client
* reuse existing timer
* reset the the auto-refresh guard on exit
The Recover() case will rebuild the AMQP client which means a new
refresh goroutine should be started.
Use a channel to synchronize with the refresh goroutine exiting.
* improved refresh goroutine synchronization
* don't exit refresh goroutine on refresh failure
* rename vars
* simplify timer
* Fix lastError race
* Move websocket pkg out of std lib to deal with proxy.
* Add WebsocketEOF to connection closed error check.
* add comment
* added ctx to flow to ns.newClient
Co-authored-by: Alexander Pashkov <alexpashkov123@gmail.com>
Co-authored-by: Chris <christopher.mcmillon@halliburton.com>
Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
* add AzureEnvironment option and use its definition
* gofmt
* fallback to previous behavior. added TODO waiting for autorest config
* add test
* go fmt
* use environment value for resourceURI
* add name to the option
* separate token provider creation
* removed redundant error check
Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
* take advantage of environment setting. prep for move to kv
* use client ID and secret specific to SB
Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
The fix in (#187) introduced a hang when closing the receiver.
Don't hold the read lock before calling Receive() as it blocks.
Return a connection closed error.
* add SubscriptionWithDefaultRuleDescription as SubscriptionManagementOption
* set default rule name to rule0 instead of non working $Default
* add test for SubscriptionWithDefaultRuleDescription
* allow user specified rule name for SubscriptionWithDefaultRuleDescription
* update changelong and version info
Co-authored-by: Nor Amelia Stenberg <nor@xinxidi.net>
Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>