https://github.com/ganesshkumar/openfaas-template-java
Java template for openfaas
https://github.com/ganesshkumar/openfaas-template-java
gradle java openfaas openfaas-template
Last synced: about 2 months ago
JSON representation
Java template for openfaas
- Host: GitHub
- URL: https://github.com/ganesshkumar/openfaas-template-java
- Owner: ganesshkumar
- Created: 2017-11-18T06:54:37.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-19T19:49:37.000Z (almost 8 years ago)
- Last Synced: 2025-07-28T21:40:38.870Z (2 months ago)
- Topics: gradle, java, openfaas, openfaas-template
- Language: Java
- Size: 63.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# openfass-template-java
Supports [fast fork](https://github.com/openfaas/faas/tree/fast_fork/watchdog#optimizing-for-performance)
## Prerequisite
* Deploy [OpenFaaS](https://github.com/openfaas/faas#get-started-with-openfaas)
* Install [OpenFaaS CLI](https://github.com/openfaas/faas-cli#get-started-install-the-cli)## 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`](https://github.com/ganesshkumar/openfaas-template-java/blob/master/template/java8-gradle/function/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`
```java
package function;public class Handler {
public String function(String input, String method) {
return "You said: " + input;
}
}
```**Note:** These willbe addressed in a better way