9.4 Calling Functions with FunctionClient
Micronaut provides support for invoking functions (either locally or deployed to a cloud provider) directly within the application context. To use the features described in this section, you will need to have the function-client
dependency on your classpath.
implementation("io.micronaut:micronaut-function-client")
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-function-client</artifactId>
</dependency>
Using the CLI If you are creating your project using the Micronaut CLI’s |
The developer’s primary use of this feature will be in defining interfaces that are annotated with FunctionClient. When this annotation is applied, methods on the interface will become invokers of respective methods on the remote (or local) function associated with the interface.
In addition, the function-client
works together with Micronaut’s Service Discovery functionality, identifying any functions that are registered with the current service discovery provider and making them available to the client application.