Skip to content
NATS event connector for OpenFaaS
Go Dockerfile Shell Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
contrib/test-functions
nats
vendor
yaml
.DEREK.yml
.gitignore
.travis.yml
Dockerfile
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
build.sh
main.go

README.md

nats-connector

Go Report Card Build Status GoDoc License: MIT OpenFaaS

The NATS connector connects OpenFaaS functions to NATS topics.

Building

export TAG=0.2.0
make build push

Try it out

Test functions have been created to help you verify the installation of nats-connector. See contrib/test-functions.

Deploy on Kubernetes

The following instructions show how to run and test nats-connector on Kubernetes.

  1. Deploy the receiver functions, the receiver function must have the topic annotation:

    export OPENFAAS_URL="http://localhost:8080" # Set your gateway via env variable or the -g flag
    faas-cli deploy --name receive-message --image openfaas/receive-message:latest --fprocess='./handler' --annotation topic="nats-test"

    Alternatively, you can deploy with the stack.yml provided in this repo

    cd contrib/test-functions
    faas-cli deploy -f stack.yml
    
  2. Deploy the connector with:

    kubectl apply -f ./yaml/kubernetes/connector-dep.yml
  3. Now publish a message on the nats-test topic. We have provided a simple function to help do this

    faas-cli deploy --name publish-message --image openfaas/publish-message:latest --fprocess='./handler' --env nats_url=nats://nats.openfaas:4222

    If you used the stack.yml in step 1, then this function is already deployed.

    Invoke the publisher

    faas-cli invoke publish-message <<< "test message"
  4. Verify that the receiver was invoked by checking the logs

    faas-cli logs receive-message
    
    2019-12-29T19:06:50Z 2019/12/29 19:06:50 received "test message"

Configuring the NATS topics

If you want to configure the topics that the connector listens to, then edit the topics env variable in yaml/kubernetes/connector-dep.yaml

You can’t perform that action at this time.