Add continuation token support for SyncPoller ARM LROs #47234
+800
−5
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.
Description
This PR adds continuation token support to
SyncPollerfor Azure Resource Manager (ARM) Long-Running Operations (LROs), enabling LROs to be resumed across process restarts or transferred between processes.What's Changed
This implementation allows users to:
Implementation Details
Core Infrastructure (
azure-core-management)PollingState: AddedtoContinuationToken()andfromContinuationToken()methods to serialize/deserialize polling stateArmLroSyncPoller: New wrapper class that implements continuation token support for ARM LRO pollersSyncPollerFactory: AddedresumeFromToken()static method to reconstruct pollers from continuation tokensInterface Extension (
azure-core)SyncPoller: AddedserializeContinuationToken()method with default implementation that throwsUnsupportedOperationExceptionSyncPollerFactorysupport this featureTesting
PollingStateContinuationTokenTestcovering token serialization/deserialization, error cases, and edge casesSyncPollerContinuationTokenTestcovering end-to-end resume workflow with mocked HTTP responsesUsage Example
Files Changed
Core Implementation (4 files):
PollingState.java- Added token serialization methodsArmLroSyncPoller.java- New wrapper for ARM LRO pollers (119 lines)SyncPollerFactory.java- Added resume functionalitySyncPoller.java- Added interface methodTests (3 files):
PollingStateContinuationTokenTest.java- Unit tests (195 lines)SyncPollerContinuationTokenTest.java- Integration tests (231 lines)FooWithProvisioningState.java- Test model updatesDocumentation (2 files):
azure-core-management/CHANGELOG.mdazure-core/CHANGELOG.mdTotal: 9 files changed, 803 insertions(+), 5 deletions(-)
Design Decisions
azure-core-management; can be extended to data-plane LROs in futureUnsupportedOperationExceptionto maintain compatibilityAll SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines