Class StatusCheckPollingStrategy<T,​U>

  • Type Parameters:
    T - the type of the response type from a polling call, or BinaryData if raw response body should be kept
    U - the type of the final result object to deserialize into, or BinaryData if raw response body should be kept
    All Implemented Interfaces:
    PollingStrategy<T,​U>

    public class StatusCheckPollingStrategy<T,​U>
    extends Object
    implements PollingStrategy<T,​U>
    Fallback polling strategy that doesn't poll but exits successfully if no other polling strategies are detected and status code is 2xx.
    • Constructor Detail

      • StatusCheckPollingStrategy

        public StatusCheckPollingStrategy()
        Creates a status check polling strategy with a JSON serializer.
      • StatusCheckPollingStrategy

        public StatusCheckPollingStrategy​(ObjectSerializer serializer)
        Creates a status check polling strategy with a custom object serializer.
        Parameters:
        serializer - a custom serializer for serializing and deserializing polling responses
    • Method Detail

      • canPoll

        public Mono<Boolean> canPoll​(Response<?> initialResponse)
        Description copied from interface: PollingStrategy
        Checks if this strategy is able to handle polling for this long running operation based on the information in the initial response.
        Specified by:
        canPoll in interface PollingStrategy<T,​U>
        Parameters:
        initialResponse - the response from the initial method call to activate the long running operation
        Returns:
        true if this polling strategy can handle the initial response, false if not
      • getResult

        public Mono<U> getResult​(PollingContext<T> pollingContext,
                                 TypeReference<U> resultType)
        Description copied from interface: PollingStrategy
        Parses the response from the final GET call into the result type of the long running operation.
        Specified by:
        getResult in interface PollingStrategy<T,​U>
        Parameters:
        pollingContext - the PollingContext for the current polling operation
        resultType - the TypeReference of the final result object to deserialize into, or BinaryData if raw response body should be kept.
        Returns:
        a publisher emitting the final result