I
- input typeO
- output type@Singleton public class HttpFunctionExecutor<I,O> extends Object implements FunctionInvoker<I,O>, Closeable, FunctionInvokerChooser
FunctionExecutor
that uses a HttpClient
to execute a remote function definition.Constructor and Description |
---|
HttpFunctionExecutor(HttpClient httpClient)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<I1,O2> Optional<FunctionInvoker<I1,O2>> |
choose(FunctionDefinition definition)
Chooses a
FunctionInvoker . |
void |
close() |
O |
invoke(FunctionDefinition definition,
I input,
Argument<O> outputType)
Invoke the given function definition for the given input and expected response type.
|
public HttpFunctionExecutor(HttpClient httpClient)
httpClient
- The HTTP clientpublic O invoke(FunctionDefinition definition, I input, Argument<O> outputType)
FunctionInvoker
invoke
in interface FunctionInvoker<I,O>
definition
- The definitioninput
- The inputoutputType
- The response typepublic <I1,O2> Optional<FunctionInvoker<I1,O2>> choose(FunctionDefinition definition)
FunctionInvokerChooser
FunctionInvoker
.choose
in interface FunctionInvokerChooser
I1
- input typeO2
- output typedefinition
- The definitionOptional
instance of FunctionInvoker
@PreDestroy public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException