diff --git a/sdk/messaging/azservicebus/CHANGELOG.md b/sdk/messaging/azservicebus/CHANGELOG.md index 13aba620af71..011652c62bc2 100644 --- a/sdk/messaging/azservicebus/CHANGELOG.md +++ b/sdk/messaging/azservicebus/CHANGELOG.md @@ -6,6 +6,11 @@ - ReceiverOptions.TimeAfterFirstMessage lets you configure the amount of time, after the first message in a batch is received, before we return messages. (PR#22154) +### Bugs Fixed + +- Settling a message (using CompleteMessage, AbandonMessage, etc..) on a different Receiver instance than you received on no + longer leaks memory. (PR#22253) + ## 1.5.0 (2023-10-10) ### Features Added diff --git a/sdk/messaging/azservicebus/go.mod b/sdk/messaging/azservicebus/go.mod index c3207f28d6e2..f84531ed2265 100644 --- a/sdk/messaging/azservicebus/go.mod +++ b/sdk/messaging/azservicebus/go.mod @@ -8,7 +8,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 - github.com/Azure/go-amqp v1.0.2 + github.com/Azure/go-amqp v1.0.4 ) require ( diff --git a/sdk/messaging/azservicebus/go.sum b/sdk/messaging/azservicebus/go.sum index e8dbc91c53fe..16eda4152e31 100644 --- a/sdk/messaging/azservicebus/go.sum +++ b/sdk/messaging/azservicebus/go.sum @@ -6,8 +6,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdE github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 h1:TuEMD+E+1aTjjLICGQOW6vLe8UWES7kopac9mUXL56Y= github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= -github.com/Azure/go-amqp v1.0.2 h1:zHCHId+kKC7fO8IkwyZJnWMvtRXhYC0VJtD0GYkHc6M= -github.com/Azure/go-amqp v1.0.2/go.mod h1:vZAogwdrkbyK3Mla8m/CxSc/aKdnTZ4IbPxl51Y5WZE= +github.com/Azure/go-amqp v1.0.4 h1:GX5OFOs706UjuFRD5PDKm3aOuLQ92F7DMbua+DKAYCc= +github.com/Azure/go-amqp v1.0.4/go.mod h1:vZAogwdrkbyK3Mla8m/CxSc/aKdnTZ4IbPxl51Y5WZE= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/sdk/messaging/azservicebus/receiver_test.go b/sdk/messaging/azservicebus/receiver_test.go index bbeecb0b710e..6925955eb112 100644 --- a/sdk/messaging/azservicebus/receiver_test.go +++ b/sdk/messaging/azservicebus/receiver_test.go @@ -22,6 +22,38 @@ import ( "github.com/stretchr/testify/require" ) +func TestReceiverBackupSettlement(t *testing.T) { + serviceBusClient, cleanup, queueName := setupLiveTest(t, &liveTestOptions{ + QueueProperties: &admin.QueueProperties{ + LockDuration: to.Ptr("PT5M"), + }, + }) + defer cleanup() + + sender, err := serviceBusClient.NewSender(queueName, nil) + require.NoError(t, err) + + err = sender.SendMessage(context.Background(), &Message{ + Body: []byte("hello world"), + }, nil) + require.NoError(t, err) + + origReceiver, err := serviceBusClient.NewReceiverForQueue(queueName, nil) + require.NoError(t, err) + defer test.RequireClose(t, origReceiver) + + otherReceiver, err := serviceBusClient.NewReceiverForQueue(queueName, nil) + require.NoError(t, err) + defer test.RequireClose(t, otherReceiver) + + messages, err := origReceiver.ReceiveMessages(context.TODO(), 1, nil) + require.NoError(t, err) + require.NotEmpty(t, messages) + + err = otherReceiver.CompleteMessage(context.Background(), messages[0], nil) + require.NoError(t, err) +} + func TestReceiverCancel(t *testing.T) { serviceBusClient, cleanup, queueName := setupLiveTest(t, nil) defer cleanup()