Class FutureDirectives

    • Constructor Detail

      • FutureDirectives

        public FutureDirectives()
    • Method Detail

      • completeOrRecoverWith

        public <T> Route completeOrRecoverWith​(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> f,
                                               Marshaller<T,​RequestEntity> marshaller,
                                               java.util.function.Function<java.lang.Throwable,​Route> inner)
        "Unwraps" a CompletionStage and runs the inner route when the stage has failed with the stage's failure exception as an extraction of type Throwable. If the completion stage succeeds the request is completed using the values marshaller (This directive therefore requires a marshaller for the completion stage value type to be provided.)

        Parameters:
        f - (undocumented)
        marshaller - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • onComplete

        public <T> RouteAdapter onComplete​(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> f,
                                           java.util.function.Function<scala.util.Try<T>,​Route> inner)
        "Unwraps" a CompletionStage and runs the inner route after future completion with the future's value as an extraction of type Try.

        Parameters:
        f - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • onComplete

        public <T> RouteAdapter onComplete​(java.util.concurrent.CompletionStage<T> cs,
                                           java.util.function.Function<scala.util.Try<T>,​Route> inner)
        "Unwraps" a CompletionStage and runs the inner route after future completion with the future's value as an extraction of type Try.

        Parameters:
        cs - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • onCompleteWithBreaker

        public <T> RouteAdapter onCompleteWithBreaker​(akka.pattern.CircuitBreaker breaker,
                                                      java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> f,
                                                      java.util.function.Function<scala.util.Try<T>,​Route> inner)
        "Unwraps" a CompletionStage[T] and runs the inner route after future completion with the future's value as an extraction of type T if the supplied CircuitBreaker is closed.

        If the supplied CircuitBreaker is open the request is rejected with a CircuitBreakerOpenRejection.

        Parameters:
        breaker - (undocumented)
        f - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • onSuccess

        public <T> RouteAdapter onSuccess​(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> f,
                                          java.util.function.Function<T,​Route> inner)
        "Unwraps" a CompletionStage and runs the inner route after stage completion with the stage's value as an extraction of type T. If the stage fails its failure Throwable is bubbled up to the nearest ExceptionHandler.

        Parameters:
        f - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • onSuccess

        public <T> RouteAdapter onSuccess​(java.util.concurrent.CompletionStage<T> cs,
                                          java.util.function.Function<T,​Route> inner)
        "Unwraps" a CompletionStage and runs the inner route after stage completion with the stage's value as an extraction of type T. If the stage fails its failure Throwable is bubbled up to the nearest ExceptionHandler.

        Parameters:
        cs - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)