Azure / Azure/azure-sdk-for-rust
[Service Bus] schedule_message returns a fabricated sequence number
- Dominant language
- Rust
- Stars
- 884
- Forks
- 365
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 109
Description
## Summary
`Sender::schedule_message` never calls the scheduling operation. It sets the scheduled enqueue time annotation, sends the message on a fresh link, then returns a sequence number derived from the system clock. `cancel_scheduled_message` cannot work, because the number it receives is not the one the service assigned.
## Motivation
The code says so at `sdk/servicebus/azure_messaging_servicebus/src/sender.rs:426`. The final lines read:
```rust
// TODO: In a real implementation, we would need to use AMQP management operations
// to get the actual sequence number from the broker. For now, return a placeholder.
let sequence_number = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
```
The documented operations are `com.microsoft:schedule-message`, which returns the assigned sequence numbers, and `com.microsoft:cancel-scheduled-message`, which takes them. Both appear in `ManagementConstants.cs` in `azure-sdk-for-net`.
A caller that schedules a message and stores the returned number has no way to cancel it. The value looks plausible, so the failure surfaces only at cancellation time.
## Proposal
- Send the message through `com.microsoft:schedule-message` and return the sequence numbers the service assigns.
- Implement `com.microsoft:cancel-scheduled-message` for one sequence number and for many.
- Add a live test that schedules a message, cancels it, and asserts it never arrives.
## Dependencies
Blocked by:
- #4936 [AMQP] Management client cannot send a typed request body or read the status fields
Sub-issue of #4934.
Contributor guide
Research direction
Start at sdk/servicebus/azure_messaging_servicebus/src/sender.rs:426 and review the management-client limitation described in #4936. Check the documented schedule and cancel operations in azure-sdk-for-net's ManagementConstants.cs. Done means returning broker-assigned sequence numbers, supporting cancellation for one or many numbers, and adding a live test that confirms a cancelled message never arrives.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, rust
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100