From c07509cff92e7e1fd6e87dcdfbdc82d2cc3a5af2 Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Wed, 24 May 2023 15:53:35 -0700 Subject: [PATCH] Update to the GA version of go-amqp (#288) * Update to the GA version of go-amqp Updated readme message with GA announcement of azeventhubs. * update changelog and version info * update internal pipeline to supported version of Ubuntu * check for specific error conditions that are now explicitly returned --- changelog.md | 4 ++++ eng/integration-tests.yml | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- hub_test.go | 6 +++++- readme.md | 4 ++-- sender.go | 2 ++ version.go | 2 +- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/changelog.md b/changelog.md index 973b0112..9e8f7d81 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Change Log +## `v3.6.0` + +- Updated to latest `azure-amqp-common-go` and GA version of `go-amqp` modules. + ## `v3.5.0` - Updated to latest `azure-amqp-common-go` and `go-amqp` modules. diff --git a/eng/integration-tests.yml b/eng/integration-tests.yml index 8cacf901..840fc449 100644 --- a/eng/integration-tests.yml +++ b/eng/integration-tests.yml @@ -6,7 +6,7 @@ variables: pr: none pool: - vmImage: 'ubuntu-18.04' + vmImage: 'ubuntu-20.04' steps: - task: GoTool@0 diff --git a/go.mod b/go.mod index b952fe49..75862e17 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,11 @@ module github.com/Azure/azure-event-hubs-go/v3 go 1.18 require ( - github.com/Azure/azure-amqp-common-go/v4 v4.1.0 + github.com/Azure/azure-amqp-common-go/v4 v4.2.0 github.com/Azure/azure-pipeline-go v0.2.3 github.com/Azure/azure-sdk-for-go v65.0.0+incompatible github.com/Azure/azure-storage-blob-go v0.15.0 - github.com/Azure/go-amqp v0.19.1 + github.com/Azure/go-amqp v1.0.0 github.com/Azure/go-autorest/autorest v0.11.28 github.com/Azure/go-autorest/autorest/adal v0.9.21 github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 diff --git a/go.sum b/go.sum index 6d668064..357e303c 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,13 @@ -github.com/Azure/azure-amqp-common-go/v4 v4.1.0 h1:gcS6P4q/Qv1nmdq1IWoU3mLYlHnvNxAhVjxReEFmSz8= -github.com/Azure/azure-amqp-common-go/v4 v4.1.0/go.mod h1:HDiTPilyFCWPOT8dBeSjGztqgrW27LctWs/4p6nR9FY= +github.com/Azure/azure-amqp-common-go/v4 v4.2.0 h1:q/jLx1KJ8xeI8XGfkOWMN9XrXzAfVTkyvCxPvHCjd2I= +github.com/Azure/azure-amqp-common-go/v4 v4.2.0/go.mod h1:GD3m/WPPma+621UaU6KNjKEo5Hl09z86viKwQjTpV0Q= github.com/Azure/azure-pipeline-go v0.2.3 h1:7U9HBg1JFK3jHl5qmo4CTZKFTVgMwdFHMVtCdfBE21U= github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k= github.com/Azure/azure-sdk-for-go v65.0.0+incompatible h1:HzKLt3kIwMm4KeJYTdx9EbjRYTySD/t8i1Ee/W5EGXw= github.com/Azure/azure-sdk-for-go v65.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-storage-blob-go v0.15.0 h1:rXtgp8tN1p29GvpGgfJetavIG0V7OgcSXPpwp3tx6qk= github.com/Azure/azure-storage-blob-go v0.15.0/go.mod h1:vbjsVbX0dlxnRc4FFMPsS9BsJWPcne7GB7onqlPvz58= -github.com/Azure/go-amqp v0.19.1 h1:S1l3HiSMU7Rhko2f70lBH6Vd0mLj5UZiTWC6xKY5Kho= -github.com/Azure/go-amqp v0.19.1/go.mod h1:+bg0x3ce5+Q3ahCEXnCsGG3ETpDQe3MEVnOuT2ywPwc= +github.com/Azure/go-amqp v1.0.0 h1:QfCugi1M+4F2JDTRgVnRw7PYXLXZ9hmqk3+9+oJh3OA= +github.com/Azure/go-amqp v1.0.0/go.mod h1:+bg0x3ce5+Q3ahCEXnCsGG3ETpDQe3MEVnOuT2ywPwc= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= diff --git a/hub_test.go b/hub_test.go index 7cf7908f..e82890a1 100644 --- a/hub_test.go +++ b/hub_test.go @@ -400,7 +400,11 @@ func testBatchSendTooLarge(ctx context.Context, t *testing.T, client *Hub, _ str } ebi := NewEventBatchIterator(events...) - assert.EqualError(t, client.SendBatch(ctx, ebi, BatchWithMaxSizeInBytes(10000000)), "encoded message size exceeds max of 1048576") + err := client.SendBatch(ctx, ebi, BatchWithMaxSizeInBytes(10000000)) + var amqpErr *amqp.Error + require.ErrorAs(t, err, &amqpErr) + assert.EqualValues(t, amqp.ErrCondMessageSizeExceeded, amqpErr.Condition) + assert.EqualValues(t, amqpErr.Description, "encoded message size exceeds max of 1048576") } func testBasicSendAndReceive(ctx context.Context, t *testing.T, client *Hub, partitionID string) { diff --git a/readme.md b/readme.md index 8af86513..3cd75d8d 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ -**Please note, a new beta package is available: [azeventhubs](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/README.md) as of [2022-11-09].** -**See the [Migration Guide](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/migrationguide.md) for more details.** +**Please note, a newer package is available: [azeventhubs](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/README.md) as of [2023-05-09].** +**We strongly encourage you to upgrade. See the [Migration Guide](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/messaging/azeventhubs/migrationguide.md) for more details.** # Microsoft Azure Event Hubs Client for Golang [![Go Report Card](https://goreportcard.com/badge/github.com/Azure/azure-event-hubs-go)](https://goreportcard.com/report/github.com/Azure/azure-event-hubs-go) diff --git a/sender.go b/sender.go index d7ac70d4..86bbc1a2 100644 --- a/sender.go +++ b/sender.go @@ -309,6 +309,8 @@ func sendMessage(ctx context.Context, getAmqpSender getAmqpSender, maxRetries in if e.Condition == errorServerBusy || e.Condition == errorTimeout { recoverLink(sender.LinkName(), err, false) break + } else if e.Condition == amqp.ErrCondMessageSizeExceeded || e.Condition == amqp.ErrCondTransferLimitExceeded { + return e } recoverLink(sender.LinkName(), err, true) case net.Error: diff --git a/version.go b/version.go index c1157a91..49485cf9 100644 --- a/version.go +++ b/version.go @@ -2,5 +2,5 @@ package eventhub const ( // Version is the semantic version number - Version = "3.5.0" + Version = "3.6.0" )