Interface FutureDirectives

All Known Subinterfaces:
Directives
All Known Implementing Classes:
Directives$, FutureDirectives$, HttpApp

public interface FutureDirectives
  • Method Summary

    Modifier and Type
    Method
    Description
    Directive<scala.Tuple1<Throwable>>
    "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.
    "Unwraps" a Future[T] and runs the inner route after future completion with the future's value as an extraction of type T.
  • Method Details

    • 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<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<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)