@FunctionalInterface
public interface ServiceCall<Request,Response>
| Modifier and Type | Method and Description |
|---|---|
default ServiceCall<Request,Response> |
handleRequestHeader(java.util.function.Function<RequestHeader,RequestHeader> handler)
Make any modifications necessary to the request header.
|
default <T> ServiceCall<Request,T> |
handleResponseHeader(java.util.function.BiFunction<ResponseHeader,Response,T> handler)
Transform the response using the given function that takes the response header and the response.
|
default java.util.concurrent.CompletionStage<Response> |
invoke()
Invoke the service call with unit id argument and a unit request message.
|
java.util.concurrent.CompletionStage<Response> |
invoke(Request request)
Invoke the service call.
|
default ServiceCall<Request,akka.japi.Pair<ResponseHeader,Response>> |
withResponseHeader()
Allow handling of the response header.
|
java.util.concurrent.CompletionStage<Response> invoke(Request request)
request - The request entity.default java.util.concurrent.CompletionStage<Response> invoke()
default ServiceCall<Request,Response> handleRequestHeader(java.util.function.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(java.util.function.BiFunction<ResponseHeader,Response,T> handler)
handler - The handler.default ServiceCall<Request,akka.japi.Pair<ResponseHeader,Response>> withResponseHeader()
handleResponseHeader(Pair::create).