I am super happy to have gotten the opportunity to test out Oracle Functions through the Cloud Native Limited Availability Program. When I last tried out running serverless functions in Oracle Cloud during the Oracle Groundbreaker APAC Tour last year, there were two options available. Either run my own Fn server in a virtual machine or set it up in a managed Kubernetes cluster. Now, a third option is available!
Oracle Functions is built on Oracle Cloud Infrastructure (OCI) and offer a managed environment for the Fn project. This means that you don’t have to manually manage an Fn cluster yourself. It also means that any function that runs on Oracle Functions will also run on any Fn server, something that offers you full flexibility.
The Fn project supports functions written in Go, Java, Node.js, Python or Ruby. The fn-duke function that I am using in this test is, of course, written in Java.
package eu.agilejava.fn;
public class HelloFunction {
public String handleRequest(String input) {
String configuredName = System.getenv("name");
String name = (input == null || input.isEmpty()) ? configuredName : input;
return "Hello, " + name + "\n";
}
}
Deployment is done by pointing to the Function Application you want your function to be part of.
fn deploy --app FunctionDuke
The function can be configured through the
fn config function FunctionDuke fn-duke name World
The configured property will then be shown in the detail view in your Oracle Cloud Function Dashboard.
Invoking the function can be done by using the Fn CLI Tool
fn invoke FunctionDuke fn-duke
Or by sending a signed request using a convenience script called oci-curl provided by Oracle.
oci-curl "x3vzdahhy3a.us-phoenix-1.functions.oci.oraclecloud.com" get "/t/fn-duke-trigger" -d 'Duke'
Conclusion
Oracle has made a good choice when investing in the Fn project and use it as a basis for the Oracle Functions platform. It integrates extremely well with Fn and no extra tooling is needed to get started.