Package de.xima.fc.proma.context
Interface IPublicPromaCallInvoker
-
- All Known Subinterfaces:
IPublicPromaCallInvokerAsync
,IPublicPromaCallInvokerSync
public interface IPublicPromaCallInvoker
An invoker that is responsible for sending API calls to PROMA. It translates anAPI calls
to anApiResponse
in an asynchronous fashion. This interface allows custom logic to be implemented for the API call. An invoker might prepare an API call by adding certain properties etc. or running the call in a different thread.- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T,C extends de.xima.proma.restclient.pub.gen.ApiCall<?>,R>
StageChain<de.xima.proma.restclient.pub.gen.ApiResponse<T>,R>invoke(C call, Function<? super C,? extends de.xima.proma.restclient.pub.gen.ApiInvocation<T>> invocationBuilder, Duration timeout)
Translates an API call into the corresponding API response.default <T,C extends de.xima.proma.restclient.pub.gen.ApiCall<?>,R>
StageChain<de.xima.proma.restclient.pub.gen.ApiResponse<T>,R>invoke(PublicPromaInvokableCall<T,C> invokableCall, Duration timeout)
Shortcut forinvoke(ApiCall, Function, Duration)
, see the JavaDocs for that method.
-
-
-
Method Detail
-
invoke
<T,C extends de.xima.proma.restclient.pub.gen.ApiCall<?>,R> StageChain<de.xima.proma.restclient.pub.gen.ApiResponse<T>,R> invoke(C call, Function<? super C,? extends de.xima.proma.restclient.pub.gen.ApiInvocation<T>> invocationBuilder, Duration timeout)
Translates an API call into the corresponding API response. The usual steps are as follows:- Apply any desired pre-processing to the given
ApiCall
. - Use the provided invocation builder to obtain an
ApiInvocation
instance. - Decide on how and when to execute the API invocation, e.g. synchronously via
invoke()
or asynchronously viarx()
. For the latter case, you could also provide anExecutor
to execute the invocation in a different context or thread. - Return a
CompletionStage
with the result.
- Type Parameters:
T
- Type of the response body.C
- Type of the API call.R
- Type of the final result.- Parameters:
call
- API call to invoke.invocationBuilder
- A builder that creates an invocation with a specific configuration from an API call.timeout
- Timeout for the request.- Returns:
- A CompletionStage that completes with the eventual result from the API call.
- Apply any desired pre-processing to the given
-
invoke
default <T,C extends de.xima.proma.restclient.pub.gen.ApiCall<?>,R> StageChain<de.xima.proma.restclient.pub.gen.ApiResponse<T>,R> invoke(PublicPromaInvokableCall<T,C> invokableCall, Duration timeout)
Shortcut forinvoke(ApiCall, Function, Duration)
, see the JavaDocs for that method.- Type Parameters:
T
- Type of the response body.C
- Type of the API call.R
- Type of the final result.- Parameters:
invokableCall
- API call to invoke, together with the builder that creates an invocation from an API call.timeout
- Timeout for the request.- Returns:
- A CompletionStage that completes with the eventual result from the API call.
-
-