Interface FutureDirectives
-
- All Known Subinterfaces:
Directives
- All Known Implementing Classes:
Directives$
,FutureDirectives$
,HttpApp
public 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" 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(akka.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 typeT
if the suppliedCircuitBreaker
is closed.Directive<java.lang.Object>
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 Detail
-
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(akka.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 typeT
if the suppliedCircuitBreaker
is closed.If the supplied
CircuitBreaker
is open the request is rejected with aCircuitBreakerOpenRejection
.- Parameters:
breaker
- (undocumented)future
- (undocumented)- Returns:
- (undocumented)
-
onSuccess
Directive<java.lang.Object> onSuccess(OnSuccessMagnet magnet)
"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 typeT
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" 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)
-
-