Class HttpFunctionExecutor<I,​O>

  • Type Parameters:
    I - input type
    O - output type
    All Implemented Interfaces:
    FunctionInvoker<I,​O>, FunctionInvokerChooser, java.io.Closeable, java.lang.AutoCloseable

    @Singleton
    public class HttpFunctionExecutor<I,​O>
    extends java.lang.Object
    implements FunctionInvoker<I,​O>, java.io.Closeable, FunctionInvokerChooser
    A FunctionExecutor that uses a HttpClient to execute a remote function definition.
    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpFunctionExecutor​(io.micronaut.http.client.HttpClient httpClient)
      Constructor.
    • Constructor Detail

      • HttpFunctionExecutor

        public HttpFunctionExecutor​(io.micronaut.http.client.HttpClient httpClient)
        Constructor.
        Parameters:
        httpClient - The HTTP client
    • Method Detail

      • invoke

        public O invoke​(FunctionDefinition definition,
                        I input,
                        io.micronaut.core.type.Argument<O> outputType)
        Description copied from interface: FunctionInvoker
        Invoke the given function definition for the given input and expected response type.
        Specified by:
        invoke in interface FunctionInvoker<I,​O>
        Parameters:
        definition - The definition
        input - The input
        outputType - The response type
        Returns:
        The result
      • close

        @PreDestroy
        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException