Interface FutureDirectives

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Directive<scala.Tuple1<java.lang.Throwable>> completeOrRecoverWith​(CompleteOrRecoverWithMagnet magnet)
      "Unwraps" a Future[T] and runs the inner route when the future has failed with the future's failure exception as an extraction of type Throwable.
      <T> Directive<scala.Tuple1<scala.util.Try<T>>> onComplete​(scala.Function0<scala.concurrent.Future<T>> future)
      "Unwraps" a Future[T] and runs the inner route after future completion with the future's value as an extraction of type Try[T].
      <T> Directive<scala.Tuple1<scala.util.Try<T>>> onCompleteWithBreaker​(akka.pattern.CircuitBreaker breaker, scala.Function0<scala.concurrent.Future<T>> future)
      "Unwraps" a Future[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.
      Directive<java.lang.Object> onSuccess​(OnSuccessMagnet magnet)
      "Unwraps" a Future[T] and runs the inner route after future completion with the future's value as an extraction of type T.
    • Method Detail

      • onComplete

        <T> Directive<scala.Tuple1<scala.util.Try<T>>> onComplete​(scala.Function0<scala.concurrent.Future<T>> future)
        "Unwraps" a Future[T] and runs the inner route after future completion with the future's value as an extraction of type Try[T].

        Parameters:
        future - (undocumented)
        Returns:
        (undocumented)
      • onCompleteWithBreaker

        <T> Directive<scala.Tuple1<scala.util.Try<T>>> onCompleteWithBreaker​(akka.pattern.CircuitBreaker breaker,
                                                                             scala.Function0<scala.concurrent.Future<T>> future)
        "Unwraps" a Future[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)
        future - (undocumented)
        Returns:
        (undocumented)
      • onSuccess

        Directive<java.lang.Object> onSuccess​(OnSuccessMagnet magnet)
        "Unwraps" a Future[T] and runs the inner route after future completion with the future's value as an extraction of type T. If the future fails its failure Throwable is bubbled up to the nearest ExceptionHandler. If type T is already a Tuple it is directly expanded into the respective number of extractions.

        Parameters:
        magnet - (undocumented)
        Returns:
        (undocumented)
      • completeOrRecoverWith

        Directive<scala.Tuple1<java.lang.Throwable>> completeOrRecoverWith​(CompleteOrRecoverWithMagnet magnet)
        "Unwraps" a Future[T] and runs the inner route when the future has failed with the future's failure exception as an extraction of type Throwable. If the future succeeds the request is completed using the values marshaller (This directive therefore requires a marshaller for the futures type to be implicitly available.)

        Parameters:
        magnet - (undocumented)
        Returns:
        (undocumented)