Interface DeferredAction


  • public interface DeferredAction
    Interface for processing deferred responses from the server.

    This interfaces is used in protocol 11 or higher.

    Since:
    3.0
    Author:
    Mark Rotteveel
    • Method Detail

      • processResponse

        void processResponse​(Response response)
        Steps to process the deferred response.
        Parameters:
        response - Response object.
      • onException

        default void onException​(java.lang.Exception exception)
        Exception received when receiving or processing the response.

        The default implementation only logs the exception on debug level.

        Parameters:
        exception - exception received processing the response
        Since:
        5
      • getWarningMessageCallback

        WarningMessageCallback getWarningMessageCallback()
        Returns:
        The warning callback to use when executing this deferred action.
      • wrapDeferredResponse

        static <T> DeferredAction wrapDeferredResponse​(DeferredResponse<T> deferredResponse,
                                                       java.util.function.Function<Response,​T> responseMapper,
                                                       WarningMessageCallback warningMessageCallback,
                                                       java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
        Type Parameters:
        T - response type of the deferred response
        Parameters:
        deferredResponse - the deferred response to wrap
        responseMapper - conversion from a Response to the appropriate object (or null) to call on DeferredResponse.onResponse(Object)
        warningMessageCallback - warning message callback to use when receiving the response
        exceptionConsumer - action to take for exceptions
        Returns:
        deferred action