public interface HttpExecutionStrategy extends ExecutionStrategy
Modifier and Type | Method and Description |
---|---|
<FS> Single<StreamingHttpResponse> |
invokeClient(Executor fallback,
Publisher<java.lang.Object> flattenedRequest,
FS flushStrategy,
ClientInvoker<FS> client)
Invokes the passed
Function and applies the necessary offloading of request and response for a client. |
<T> Single<T> |
invokeService(Executor fallback,
java.util.function.Function<Executor,T> service)
Invokes a service represented by the passed
Function . |
Publisher<java.lang.Object> |
invokeService(Executor fallback,
StreamingHttpRequest request,
java.util.function.Function<StreamingHttpRequest,Publisher<java.lang.Object>> service,
java.util.function.BiFunction<java.lang.Throwable,Executor,Publisher<java.lang.Object>> errorHandler)
Invokes the passed
Function and applies the necessary offloading of request and response for a server. |
boolean |
isDataReceiveOffloaded()
Returns
true if data receive offloading is enabled for this ExecutionStrategy . |
boolean |
isMetadataReceiveOffloaded()
Returns
true if metadata receive offloading is enabled for this ExecutionStrategy . |
boolean |
isSendOffloaded()
Returns
true if send offloading is enabled for this ExecutionStrategy . |
HttpExecutionStrategy |
merge(HttpExecutionStrategy other)
Merges the passed
HttpExecutionStrategy with this HttpExecutionStrategy and return the
merged result. |
StreamingHttpService |
offloadService(Executor fallback,
StreamingHttpService handler)
Wraps the passed
StreamingHttpService to apply this HttpExecutionStrategy . |
executor, offloadReceive, offloadReceive, offloadSend, offloadSend
<FS> Single<StreamingHttpResponse> invokeClient(Executor fallback, Publisher<java.lang.Object> flattenedRequest, @Nullable FS flushStrategy, ClientInvoker<FS> client)
Function
and applies the necessary offloading of request and response for a client.FS
- The FlushStrategy
type to use.fallback
- Executor
to use as a fallback if this HttpExecutionStrategy
does not define an
Executor
.flattenedRequest
- A flattened Publisher
containing all data constituting an HTTP request.flushStrategy
- The FlushStrategy
to use.client
- A BiFunction
that given flattened stream of HttpRequestMetaData
, payload and
trailers, for the passed StreamingHttpRequest
returns a Single
.Single
which is offloaded as required.Publisher<java.lang.Object> invokeService(Executor fallback, StreamingHttpRequest request, java.util.function.Function<StreamingHttpRequest,Publisher<java.lang.Object>> service, java.util.function.BiFunction<java.lang.Throwable,Executor,Publisher<java.lang.Object>> errorHandler)
Function
and applies the necessary offloading of request and response for a server.fallback
- Executor
to use as a fallback if this HttpExecutionStrategy
does not define an
Executor
.request
- StreamingHttpRequest
for which the offloading is to be applied.service
- A Function
that executes a StreamingHttpRequest
and returns a flattened
Publisher
containing all data constituting an HTTP response.errorHandler
- In case there is an error before calling the passed service
, this BiFunction
will be called to generate an error response.Publisher
containing all data constituting an HTTP response..<T> Single<T> invokeService(Executor fallback, java.util.function.Function<Executor,T> service)
Function
.
This method does not apply the strategy on the object returned from the Function
, if that object is an
asynchronous source then the caller of this method should take care and offload that source using
ExecutionStrategy.offloadSend(Executor, Single)
or ExecutionStrategy.offloadSend(Executor, Publisher)
.
T
- Type of result of the invocation of the service.fallback
- Executor
to use as a fallback if this HttpExecutionStrategy
does not define an
Executor
.service
- Function
representing a service.Single
that invokes the passed Function
and returns the result asynchronously.
Invocation of Function
will be offloaded if configured.StreamingHttpService offloadService(Executor fallback, StreamingHttpService handler)
StreamingHttpService
to apply this HttpExecutionStrategy
.fallback
- Executor
to use as a fallback if this HttpExecutionStrategy
does not define an
Executor
.handler
- StreamingHttpService
to wrap.StreamingHttpService
.boolean isMetadataReceiveOffloaded()
true
if metadata receive offloading is enabled for this ExecutionStrategy
.true
if metadata receive offloading is enabled for this ExecutionStrategy
.boolean isDataReceiveOffloaded()
true
if data receive offloading is enabled for this ExecutionStrategy
.true
if data receive offloading is enabled for this ExecutionStrategy
.boolean isSendOffloaded()
true
if send offloading is enabled for this ExecutionStrategy
.true
if send offloading is enabled for this ExecutionStrategy
.HttpExecutionStrategy merge(HttpExecutionStrategy other)
HttpExecutionStrategy
with this
HttpExecutionStrategy
and return the
merged result.other
- HttpExecutionStrategy
to merge with this
.HttpExecutionStrategy
.