Skip to content

modernizing-java-applications-book/quarkus-faas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Function project

Welcome to your new Quarkus function project!

This sample project contains a single function: functions.Function.function(), the function just returns its argument.

Local execution

Make sure that Java 11 SDK is installed.

To start server locally run ./mvnw quarkus:dev. The command starts http server and automatically watches for changes of source code. If source code changes the change will be propagated to running server. It also opens debugging port 5005 so debugger can be attached if needed.

To run test locally run ./mvnw test.

The func CLI

It's recommended to set FUNC_REGISTRY environment variable.

# replace ~/.bashrc by your shell rc file
# replace docker.io/johndoe with your registry
export FUNC_REGISTRY=docker.io/johndoe
echo "export FUNC_REGISTRY=docker.io/johndoe" >> ~/.bashrc 

Building

This command builds OCI image for the function.

func build                  # build jar
func build --builder native # build native binary

Running

This command runs the func locally in a container using the image created above.

func run

Deploying

This commands will build and deploy the function into cluster.

func deploy # also triggers build

Function invocation

Do not forget to set URL variable to the route of your function.

You get the route by following command.

func describe

cURL

URL=http://localhost:8080/
curl -v ${URL} \
  -H "Content-Type:application/json" \
  -d "{\"message\": \"$(whoami)\"}\""
# OR
URL="http://localhost:8080/?message=$(whoami)"
curl -v ${URL} 

HTTPie

URL=http://localhost:8080/
http -v ${URL} \
  message=$(whoami)
# OR
URL="http://localhost:8080/?message=$(whoami)"
http -v ${URL}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages