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
ConstructorDescriptionHttpFunctionExecutor
(ConversionService conversionService, HttpClient httpClient) Constructor. -
Method Summary
Modifier and TypeMethodDescription<I1,
O2> Optional<FunctionInvoker<I1, O2>> choose
(FunctionDefinition definition) Chooses aFunctionInvoker
.void
close()
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:FunctionInvoker
Invoke the given function definition for the given input and expected response type.- Specified by:
invoke
in interfaceFunctionInvoker<I,
O> - Parameters:
definition
- The definitioninput
- The inputoutputType
- The response type- Returns:
- The result
-
choose
Description copied from interface:FunctionInvokerChooser
Chooses aFunctionInvoker
.- Specified by:
choose
in interfaceFunctionInvokerChooser
- Type Parameters:
I1
- input typeO2
- output type- Parameters:
definition
- The definition- Returns:
- An
Optional
instance ofFunctionInvoker
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-