Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 319bf88

Browse files
zedarrobertzakrzewski-tomtomjhendrixMSFT
authored
Add associate-link-name property to RenewLocks function. (#225)
* 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 <[email protected]> Co-authored-by: Joel Hendrix <[email protected]>
1 parent 73da336 commit 319bf88

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.12
55
require (
66
github.com/Azure/azure-amqp-common-go/v3 v3.1.0
77
github.com/Azure/azure-sdk-for-go v51.1.0+incompatible
8-
github.com/Azure/go-amqp v0.13.6
8+
github.com/Azure/go-amqp v0.13.7
99
github.com/Azure/go-autorest/autorest v0.11.18
1010
github.com/Azure/go-autorest/autorest/adal v0.9.13
1111
github.com/Azure/go-autorest/autorest/date v0.3.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/Azure/azure-amqp-common-go/v3 v3.1.0/go.mod h1:PBIGdzcO1teYoufTKMcGib
33
github.com/Azure/azure-sdk-for-go v51.1.0+incompatible h1:7uk6GWtUqKg6weLv2dbKnzwb0ml1Qn70AdtRccZ543w=
44
github.com/Azure/azure-sdk-for-go v51.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
55
github.com/Azure/go-amqp v0.13.0/go.mod h1:qj+o8xPCz9tMSbQ83Vp8boHahuRDl5mkNHyt1xlxUTs=
6-
github.com/Azure/go-amqp v0.13.6 h1:CWjyY59Iyc1sO/fE/AubMLMWf5id+Uiw/ph0bZzG9Ns=
7-
github.com/Azure/go-amqp v0.13.6/go.mod h1:wbpCKA8tR5MLgRyIu+bb+S6ECdIDdYJ0NlpFE9xsBPI=
6+
github.com/Azure/go-amqp v0.13.7 h1:ukcCtx138ZmOfHbdALuh9yoJhGtOY3+yaKApfzNvhSk=
7+
github.com/Azure/go-amqp v0.13.7/go.mod h1:wbpCKA8tR5MLgRyIu+bb+S6ECdIDdYJ0NlpFE9xsBPI=
88
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
99
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
1010
github.com/Azure/go-autorest/autorest v0.11.3 h1:fyYnmYujkIXUgv88D9/Wo2ybE4Zwd/TmQd5sSI5u2Ws=

message.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ func NewMessage(data []byte) *Message {
131131
}
132132
}
133133

134+
// getLinkName returns associated link name or empty string if receiver or link is not defined,
135+
func (m *Message) getLinkName() string {
136+
return m.message.GetLinkName()
137+
}
138+
134139
// CompleteAction will notify Azure Service Bus that the message was successfully handled and should be deleted from the
135140
// queue
136141
func (m *Message) CompleteAction() DispositionAction {

operation_constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ const (
1515
operationFieldName = "operation"
1616
lockTokensFieldName = "lock-tokens"
1717
serverTimeoutFieldName = vendorPrefix + "server-timeout"
18+
associatedLinkName = "associated-link-name"
1819
)

rpc.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ func (r *rpcClient) RenewLocks(ctx context.Context, messages ...*Message) error
396396
ctx, span := startConsumerSpanFromContext(ctx, "sb.RenewLocks")
397397
defer span.End()
398398

399+
var linkName string
399400
lockTokens := make([]amqp.UUID, 0, len(messages))
400401
for _, m := range messages {
401402
if m.LockToken == nil {
@@ -405,6 +406,9 @@ func (r *rpcClient) RenewLocks(ctx context.Context, messages ...*Message) error
405406

406407
amqpLockToken := amqp.UUID(*m.LockToken)
407408
lockTokens = append(lockTokens, amqpLockToken)
409+
if linkName == "" {
410+
linkName = m.getLinkName()
411+
}
408412
}
409413

410414
if len(lockTokens) < 1 {
@@ -420,6 +424,9 @@ func (r *rpcClient) RenewLocks(ctx context.Context, messages ...*Message) error
420424
lockTokensFieldName: lockTokens,
421425
},
422426
}
427+
if linkName != "" {
428+
renewRequestMsg.ApplicationProperties[associatedLinkName] = linkName
429+
}
423430

424431
response, err := r.doRPCWithRetry(ctx, r.ec.ManagementPath(), renewRequestMsg, 3, 1*time.Second)
425432
if err != nil {

0 commit comments

Comments
 (0)