T
- the type of the response type from a polling call, or BinaryData if raw response body should be keptU
- the type of the final result object to deserialize into, or BinaryData if raw response body should be
keptpublic final class DefaultPollingStrategy<T,U> extends Object implements PollingStrategy<T,U>
OperationResourcePollingStrategy
, LocationPollingStrategy
, and
StatusCheckPollingStrategy
, in this order. The first strategy that can poll on the initial response will be
used. The created chained polling strategy is capable of handling most of the polling scenarios in Azure.Constructor and Description |
---|
DefaultPollingStrategy(HttpPipeline httpPipeline)
Creates a chained polling strategy with 3 known polling strategies,
OperationResourcePollingStrategy ,
LocationPollingStrategy , and StatusCheckPollingStrategy , in this order, with a JSON serializer. |
DefaultPollingStrategy(HttpPipeline httpPipeline,
JsonSerializer serializer)
Creates a chained polling strategy with 3 known polling strategies,
OperationResourcePollingStrategy ,
LocationPollingStrategy , and StatusCheckPollingStrategy , in this order, with a custom
serializer. |
Modifier and Type | Method and Description |
---|---|
Mono<Boolean> |
canPoll(Response<?> initialResponse)
Checks if this strategy is able to handle polling for this long running operation based on the information in
the initial response.
|
Mono<U> |
getResult(PollingContext<T> context,
TypeReference<U> resultType)
Parses the response from the final GET call into the result type of the long running operation.
|
Mono<PollResponse<T>> |
onInitialResponse(Response<?> response,
PollingContext<T> pollingContext,
TypeReference<T> pollResponseType)
Parses the initial response into a
LongRunningOperationStatus , and stores information useful for polling
in the PollingContext . |
Mono<PollResponse<T>> |
poll(PollingContext<T> context,
TypeReference<T> pollResponseType)
Parses the response from the polling URL into a
PollResponse , and stores information
useful for further polling and final response in the PollingContext . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel
public DefaultPollingStrategy(HttpPipeline httpPipeline)
OperationResourcePollingStrategy
,
LocationPollingStrategy
, and StatusCheckPollingStrategy
, in this order, with a JSON serializer.httpPipeline
- an instance of HttpPipeline
to send requests withpublic DefaultPollingStrategy(HttpPipeline httpPipeline, JsonSerializer serializer)
OperationResourcePollingStrategy
,
LocationPollingStrategy
, and StatusCheckPollingStrategy
, in this order, with a custom
serializer.httpPipeline
- an instance of HttpPipeline
to send requests withserializer
- a custom serializer for serializing and deserializing polling responsespublic Mono<U> getResult(PollingContext<T> context, TypeReference<U> resultType)
PollingStrategy
getResult
in interface PollingStrategy<T,U>
context
- the PollingContext
for the current polling operationresultType
- the TypeReference
of the final result object to deserialize into, or BinaryData if
raw response body should be kept.public Mono<Boolean> canPoll(Response<?> initialResponse)
PollingStrategy
canPoll
in interface PollingStrategy<T,U>
initialResponse
- the response from the initial method call to activate the long running operationpublic Mono<PollResponse<T>> onInitialResponse(Response<?> response, PollingContext<T> pollingContext, TypeReference<T> pollResponseType)
PollingStrategy
LongRunningOperationStatus
, and stores information useful for polling
in the PollingContext
. If the result is anything other than LongRunningOperationStatus.IN_PROGRESS
,
the long running operation will be terminated and none of the other methods will be invoked.onInitialResponse
in interface PollingStrategy<T,U>
response
- the response from the initial method call to activate the long running operationpollingContext
- the PollingContext
for the current polling operationpollResponseType
- the TypeReference
of the response type from a polling call, or BinaryData if raw
response body should be kept. This should match the generic parameter U
.public Mono<PollResponse<T>> poll(PollingContext<T> context, TypeReference<T> pollResponseType)
PollingStrategy
PollResponse
, and stores information
useful for further polling and final response in the PollingContext
. The result must have the
LongRunningOperationStatus
specified, and the entire polling response content as a BinaryData
.poll
in interface PollingStrategy<T,U>
context
- the PollingContext
for the current polling operationpollResponseType
- the TypeReference
of the response type from a polling call, or BinaryData if raw
response body should be kept. This should match the generic parameter U
.Copyright © 2021 Microsoft Corporation. All rights reserved.