Azure / Azure/azure-sdk-for-rust

[Service Bus] Lock token handling is wrong for deferred messages and for the GUID encoding

Open
#4,945 0 comments 1 reaction 0 assignees View on GitHub
bug Client Service Bus
Dominant language
Rust
Stars
884
Forks
365
Avg merge
2d 19h
Merged PRs (30d)
109

Description

## Summary

The lock token is read from the wrong place for deferred messages, and the conversion from the AMQP delivery tag to the wire GUID is not implemented.

## Motivation

The lock token is normally the AMQP delivery tag of the received message. Deferred messages are the documented exception. A message fetched by `com.microsoft:receive-by-sequence-number` carries its own lock token property, and that property is present only when the receiver settle mode is peek lock. The exception applies to `com.microsoft:update-disposition` as well as to `com.microsoft:renew-lock`.

The encoding is also a trap. The delivery tag is AMQP binary, but `lock-tokens` is typed as an array of uuid, so the 16 byte tag has to be decoded as a GUID whose first three fields are little endian. A naive big endian read produces a token the service rejects.

## Proposal

- Read the lock token from the delivery tag for messages received on a link.
- Read it from the message lock token property for messages returned by `receive-by-sequence-number`.
- Decode the 16 byte tag as a GUID with little endian first three fields, and add a unit test with a known tag and its expected GUID.
- Send lock tokens as a uuid array in the request body rather than as a string in the application properties.

## Dependencies

Blocked by:

- #4936 [AMQP] Management client cannot send a typed request body or read the status fields

Sub-issue of #4934.

Contributor guide

Open the contributing guide

Research direction

Start by reading the management-client work in blocked issue #4936 and trace the Service Bus paths for receive-by-sequence-number, update-disposition, and renew-lock. Verify where link delivery tags and deferred-message lock token properties enter the request flow. Done means the correct token source is used, the 16-byte tag decodes to the expected little-endian GUID, and a unit test covers that known tag.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, rust
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.