GitHunt
GA

ganesshkumar/openfaas-template-java

Java template for openfaas

openfass-template-java

Supports fast fork

Prerequisite

Usage

Pull template and create a new function

$ faas-cli template pull https://github.com/ganesshkumar/openfaas-template-java

$ faa-cli new --lang java8-gradle java-function

Build and deploy to OpenFaaS

$ faas-cli build -f java-function.yml

$ faas-cli deploy -f java-function.yml

Test your function

$ echo test | faas-cli invoke java-function
You said: openfaas

Updating the function

  • Once you execute faas-cli new command, a new folder is created for your function.
  • This folder is nothing but a gradle project with a rudimentary build.gradle file.
  • There must be a class function.Hander with a method function(String requesBody, String httpMethod) which is the starting point of your function.

Current limitation

  • The template looks for function.Handler class which has a method called function
package function;

public class Handler {
    public String function(String input, String method) {
        return "You said: " + input;
    }
}

Note: These willbe addressed in a better way

Languages

Java100.0%

Contributors

Created November 18, 2017
Updated December 10, 2017
ganesshkumar/openfaas-template-java | GitHunt