Class HttpFunctionExecutor<I,O>
java.lang.Object
io.micronaut.function.client.http.HttpFunctionExecutor<I,O>
- Type Parameters:
I- input typeO- output type
- All Implemented Interfaces:
FunctionInvoker<I,,O> FunctionInvokerChooser,Closeable,AutoCloseable
@Singleton
public class HttpFunctionExecutor<I,O>
extends Object
implements FunctionInvoker<I,O>, Closeable, FunctionInvokerChooser
A
FunctionExecutor that uses a HttpClient to execute a remote function definition.- Since:
- 1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorsConstructorDescriptionHttpFunctionExecutor(ConversionService conversionService, HttpClient httpClient) Constructor. -
Method Summary
Modifier and TypeMethodDescription<I1,O2> Optional<FunctionInvoker<I1, O2>> choose(FunctionDefinition definition) Chooses aFunctionInvoker.voidclose()invoke(FunctionDefinition definition, I input, Argument<O> outputType) Invoke the given function definition for the given input and expected response type.
-
Constructor Details
-
HttpFunctionExecutor
Constructor.- Parameters:
conversionService- The conversion servicehttpClient- The HTTP client
-
-
Method Details
-
invoke
Description copied from interface:FunctionInvokerInvoke the given function definition for the given input and expected response type.- Specified by:
invokein interfaceFunctionInvoker<I,O> - Parameters:
definition- The definitioninput- The inputoutputType- The response type- Returns:
- The result
-
choose
Description copied from interface:FunctionInvokerChooserChooses aFunctionInvoker.- Specified by:
choosein interfaceFunctionInvokerChooser- Type Parameters:
I1- input typeO2- output type- Parameters:
definition- The definition- Returns:
- An
Optionalinstance ofFunctionInvoker
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-