Now available as part of trisberg/spring-knative-cloudevents-2020
This document is a Work in Progress.
minikube start --memory=4096 --cpus=4 --vm-driver=kvm2 --kubernetes-version 1.17.2 | |
kapp deploy -n apps -a cert-manager -f https://storage.googleapis.com/projectriff/release/0.5.0-snapshot/cert-manager.yaml -y | |
kapp deploy -n apps -a kpack -f https://storage.googleapis.com/projectriff/release/0.5.0-snapshot/kpack.yaml -y | |
kapp deploy -n apps -a riff-builders -f https://storage.googleapis.com/projectriff/release/0.5.0-snapshot/riff-builders.yaml -y | |
kapp deploy -n apps -a riff-build -f https://storage.googleapis.com/projectriff/release/0.5.0-snapshot/riff-build.yaml -y | |
ytt -f https://storage.googleapis.com/projectriff/release/0.5.0-snapshot/istio.yaml -f https://storage.googleapis.com/projectriff/charts/overlays/service-nodeport.yaml --file-mark istio.yaml:type=yaml-plain | kapp deploy -n apps -a istio -f - -y | |
kapp deploy -n apps -a knative -f https://storage.googleapis.com/projectriff/release/0.5.0-snapshot/knative.yaml -y |
set -euo pipefail | |
set -x | |
# delete riff/knative resources | |
kubectl delete riff --all-namespaces --all | |
kubectl delete knative --all-namespaces --all | |
# riff streaming runtime | |
kapp delete -y -n apps -a riff-streaming-runtime | |
kapp delete -y -n apps -a keda |
Spring Cloud Task allows a user to develop and run short lived microservices using Spring Cloud and run them locally or in the cloud. They can also be run as part of Spring Cloud Data Flow. We thought that it would be interesting if we could add a task runtime to riff to run tasks there. This document explains how to run a quick demo of this task runtime POC.
Download the riff-task-poc-demo.zip archive and unzip it in a riff-task-demo
directory.
Java functions will be invoked using a Java Function Invoker that is provided by riff when you build the function.
The Java Function Invoker is a Spring Boot application which will locate your function based on configuration settings, and invoke the function for each request.
The riff function support for the Java language relies on function code being written using interfaces like Function<T,R>
, Supplier<T>
, or Consumer<T>
from the java.util.function
package in the Java SE platform.
The implementation can be provided as a plain Java class or as part of a Spring Boot app.
To build and deploy your function locally you can use the riff
CLI which can be installed following the instructions on the riff Release page.
You also need to have riff and Knative installed on a local Minikube or Docker for Mac cluster, just follow the instructions we linked to.
If you are using Minikube then you should configure Docker to use the Docker environment running in Minikube:
Important
|
This document is deprecated, you want to look at A tale of four backing service bindings instead. |
Add the GCP Spanner starter dependency (the bold parts are the additions):
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>