fix: align list-sessions pagination to .NET short-page termination - #49969
Open
EldertGrootenboer wants to merge 4 commits into
Open
fix: align list-sessions pagination to .NET short-page termination#49969EldertGrootenboer wants to merge 4 commits into
EldertGrootenboer wants to merge 4 commits into
Conversation
…rmination Terminate session enumeration when the broker returns a page smaller than the requested page size (a short or empty page signals the end), matching the .NET SDK's page.Count < SessionBrowsePageSize rule. Previously the async session receiver stopped only on an empty page. Updates the public javadoc on both listSessions() overloads and the ServiceBusManagementNode.getMessageSessions contract, plus the unit tests.
|
Azure Pipelines: Successfully started running 1 pipeline(s). 33 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Service Bus session ID pagination termination in the Java SDK to match the “short page ends enumeration” behavior used by the other Service Bus SDKs (notably .NET): paging stops when the service returns fewer session IDs than the requested page size, rather than requiring an explicitly empty page.
Changes:
- Updated
ServiceBusSessionReceiverAsyncClient.fetchSessionPageto terminate pagination whensessionIds.size() < pageSize. - Updated public JavaDoc for
listSessions()overloads and theServiceBusManagementNode.getMessageSessionscontract to document short-page termination semantics. - Reworked pagination tests to ensure the first page is a full page (so the continuation-token/cursor path is exercised under the new termination rule).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClient.java | Changes paging termination from “empty page” to “short page” and updates method JavaDoc accordingly. |
| sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementNode.java | Updates the management-node contract documentation to describe short-page termination. |
| sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java | Updates tests to validate the new termination behavior while still exercising cursor/skip handling. |
Member
Author
|
/azp run java - pullrequest |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
EldertGrootenboer
marked this pull request as ready for review
July 29, 2026 15:23
EldertGrootenboer
requested review from
a team and
skarri-microsoft
as code owners
July 29, 2026 15:23
|
Azure Pipelines: Successfully started running 1 pipeline(s). 33 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns
listSessions()/ get-message-sessions pagination termination with the .NET SDK's short-page rule: enumeration stops when the broker returns a page with fewer session IDs than the requested page size (a short or empty page signals the end), instead of continuing until an explicit empty page.This matches .NET's
if (page.Count < SessionBrowsePageSize) break;and brings all five Service Bus SDKs to identical termination behavior:page.Count < SessionBrowsePageSizenextPageLink: page.length >= top ? ... : undefinedlen(result) < _PAGE_SIZElen(page) < listSessionsPageSizesessionIds.size() < pageSizeBehavior
size == pageSize): continue to the next page.size < pageSize): stop; the last page's IDs are still returned.Changes
ServiceBusSessionReceiverAsyncClient.fetchSessionPageterminates on a short page.listSessions()overloads and theServiceBusManagementNode.getMessageSessionscontract updated to describe short-page termination.ServiceBusSessionReceiverAsyncClientTestrewritten so each pagination test drives a full first page (exercising the cursor / server-skip logic under short-page termination).Testing
ServiceBusSessionReceiverAsyncClientTesttests pass;spotless:checkandcheckstyle:checkclean.Refinement to the unreleased
7.18.0-beta.3feature; no new changelog entry.