FutureDirectives

org.apache.pekko.http.scaladsl.server.directives.FutureDirectives
See theFutureDirectives companion object

Attributes

Companion
object
Source
FutureDirectives.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Directives
object Directives
class HttpApp

Members list

Grouped members

Future directives

"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.)

"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.)

Attributes

Source
FutureDirectives.scala
def onComplete[T](future: => Future[T]): Directive1[Try[T]]

"Unwraps" a Future[T] and runs the inner route after future completion with the future's value as an extraction of type Try[T].

"Unwraps" a Future[T] and runs the inner route after future completion with the future's value as an extraction of type Try[T].

Attributes

Source
FutureDirectives.scala
def onCompleteWithBreaker[T](breaker: CircuitBreaker)(future: => Future[T]): Directive1[Try[T]]

"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 if the supplied CircuitBreaker is closed.

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

Attributes

Source
FutureDirectives.scala
def onSuccess(magnet: OnSuccessMagnet): Directive[magnet.Out]

"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.

"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.

Attributes

Source
FutureDirectives.scala