@FunctionalInterface public interface ServiceCall<Request,Response>
Modifier and Type | Method and Description |
---|---|
default ServiceCall<Request,Response> |
handleRequestHeader(Function<RequestHeader,RequestHeader> handler)
Make any modifications necessary to the request header.
|
default <T> ServiceCall<Request,T> |
handleResponseHeader(BiFunction<ResponseHeader,Response,T> handler)
Transform the response using the given function that takes the response header and the response.
|
default CompletionStage<Response> |
invoke()
Invoke the service call with unit id argument and a unit request message.
|
CompletionStage<Response> |
invoke(Request request)
Invoke the service call.
|
default ServiceCall<Request,akka.japi.Pair<ResponseHeader,Response>> |
withResponseHeader()
Allow handling of the response header.
|
CompletionStage<Response> invoke(Request request)
request
- The request entity.default CompletionStage<Response> invoke()
default ServiceCall<Request,Response> handleRequestHeader(Function<RequestHeader,RequestHeader> handler)
RequestHeader.DEFAULT
exists for this
purpose. Generally, server implementations should not implement this method directly, rather, they should use
ServerServiceCall, which provides an appropriate implementation.handler
- A function that takes in the request header representing the request, and transforms it.default <T> ServiceCall<Request,T> handleResponseHeader(BiFunction<ResponseHeader,Response,T> handler)
handler
- The handler.default ServiceCall<Request,akka.japi.Pair<ResponseHeader,Response>> withResponseHeader()
handleResponseHeader(Pair::create)
.