Skip to content

michaelmerg/serverless-function-runtime-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Serverless function runtime for Java

Build Status

Java 8 template for OpenFaas

Quick Start

Pull template from GitHub:

$ faas-cli template pull https://github.com/michaelmerg/serverless-function-runtime-java

Create new function:

$ faas-cli new --lang java-gradle java-echo

Build function:

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

Deploy function:

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

Invoke function:

$ faas-cli invoke java-echo

Overview

There are two different supported handler interfaces. The basic request handler supports simple Java types or a POJO types as input and output. With the streaming request handler you can handle the input and output as byte streams.

Request handler

public class Handler implements RequestHandler<String, String> {

  @Override
  public String handle(String input, Context context) {

    // Add function code here
    return input;
  }
}

Streaming request handler

public class StreamingHandler implements StreamingRequestHandler {

  @Override
  public void handle(InputStream input, OutputStream output, Context context) {

    // read input stream
    // write output stream
  }
}

Releases

No releases published

Packages

No packages published

Languages