Interface FutureDirectives
- All Known Subinterfaces:
Directives
- All Known Implementing Classes:
Directives$,FutureDirectives$,HttpApp
public interface FutureDirectives
-
Method Summary
Modifier and TypeMethodDescription"Unwraps" aFuture[T]and runs the inner route when the future has failed with the future's failure exception as an extraction of typeThrowable.<T> Directive<scala.Tuple1<scala.util.Try<T>>>onComplete(scala.Function0<scala.concurrent.Future<T>> future) "Unwraps" aFuture[T]and runs the inner route after future completion with the future's value as an extraction of typeTry[T].<T> Directive<scala.Tuple1<scala.util.Try<T>>>onCompleteWithBreaker(org.apache.pekko.pattern.CircuitBreaker breaker, scala.Function0<scala.concurrent.Future<T>> future) "Unwraps" aFuture[T]and runs the inner route after future completion with the future's value as an extraction of typeTif the suppliedCircuitBreakeris closed.onSuccess(OnSuccessMagnet magnet) "Unwraps" aFuture[T]and runs the inner route after future completion with the future's value as an extraction of typeT.
-
Method Details
-
onComplete
<T> Directive<scala.Tuple1<scala.util.Try<T>>> onComplete(scala.Function0<scala.concurrent.Future<T>> future) "Unwraps" aFuture[T]and runs the inner route after future completion with the future's value as an extraction of typeTry[T].- Parameters:
future- (undocumented)- Returns:
- (undocumented)
-
onCompleteWithBreaker
<T> Directive<scala.Tuple1<scala.util.Try<T>>> onCompleteWithBreaker(org.apache.pekko.pattern.CircuitBreaker breaker, scala.Function0<scala.concurrent.Future<T>> future) "Unwraps" aFuture[T]and runs the inner route after future completion with the future's value as an extraction of typeTif the suppliedCircuitBreakeris closed.If the supplied
CircuitBreakeris open the request is rejected with aCircuitBreakerOpenRejection.- Parameters:
breaker- (undocumented)future- (undocumented)- Returns:
- (undocumented)
-
onSuccess
"Unwraps" aFuture[T]and runs the inner route after future completion with the future's value as an extraction of typeT. If the future fails its failure Throwable is bubbled up to the nearest ExceptionHandler. If typeTis already a Tuple it is directly expanded into the respective number of extractions.- Parameters:
magnet- (undocumented)- Returns:
- (undocumented)
-
completeOrRecoverWith
"Unwraps" aFuture[T]and runs the inner route when the future has failed with the future's failure exception as an extraction of typeThrowable. 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)
-