This repository contains some prepared OpenFaas functions that can be used for transforming or routing of messages (CloudEvents).
A more detailed tutorial is located here.
Login to OpenFaaS Gateway:
echo -n $PASSWORD | faas-cli login --password-stdin
Deploy function:
faas deploy
Using up instand of deploy results in a build, push and deploy.
Kubernetes:
Port forwarding to OpenFaaS Gateway:
kubectl port-forward svc/gateway -n openfaas 8080
Get logs of function running in Kubernetes cluster:
kubectl -n $NAMESPACE logs -f $(kubectl get pods -n $NAMESPACE --selector=faas_function=$FUNCTION_NAME --output=jsonpath={.items..metadata.name})
The Messaging to HTTP Adapter FaaS function which is used in our demo is located in the Adapter/MessagingToHttpAdapter folder.
It requires the Cloud Event attributes adapterRequestUrl
, adapterRequestMethod
and expects messages of the type "httpEnvelop" with the content type "application/json". The HTTP to Messaging Adapter Component produces the right messages. The function executes the HTTP request which is embedded in the message and produces a response message from the HTTP response.