This project provides a collection of functions manipulating Cloud Events.
All functions are currently only callable (synchronous). We are planning to add composable (asynchronous) functions the near future.
You first need to install the Knative Eventing Function Controller:
kubectl apply -f https://github.com/lionelvillard/knative-functions-controller/releases/download/v0.1.2/function.yaml
Then install the function library:
kubectl apply -f https://github.com/lionelvillard/knative-functions/releases/download/v0.2.0/functions.yaml
The functions are:
The Wait
function forward events after X seconds.
apiVersion: functions.knative.dev/v1alpha1
kind: Wait
metadata:
name: wait-5
spec:
seconds: 5
A filter takes a cloud event as input, evaluates a predicate against it and returns the unmodified event when the predicate return true, otherwise returns an empty response.
The predicate must be a Javascript expression. It is evaluated in a sandbox with the variable event
apiVersion: functions.knative.dev/v1alpha1
kind: Filter
metadata:
name: filter
spec:
expression: event.data.assigned