Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mqtrigger test
# Create mq trigger
$ fission mqt create --name mqt-test --function <function name> --topic <topic-name>
# Check wether nats-streaming server create a channel to receive message
$ kubectl -n fission logs -f <nats-streaming pod>
[1] 2018/08/27 06:19:00.989160 [INF] STREAM: Starting nats-streaming-server[fissionMQTrigger] version 0.10.2
[1] 2018/08/27 06:19:00.989192 [INF] STREAM: ServerID: qYfsXq0SHJ6ud9madIckpq
[1] 2018/08/27 06:19:00.989195 [INF] STREAM: Go version: go1.10.3
[1] 2018/08/27 06:19:00.989636 [INF] Starting nats-server version 1.1.0
[1] 2018/08/27 06:19:00.989855 [INF] Git commit [not set]
[1] 2018/08/27 06:19:00.989919 [INF] Listening for client connections on 0.0.0.0:4222
[1] 2018/08/27 06:19:00.989922 [INF] Server is ready
[1] 2018/08/27 06:19:01.027093 [INF] STREAM: Recovering the state...
[1] 2018/08/27 06:19:01.027230 [INF] STREAM: No recovered state
[1] 2018/08/27 06:19:01.278119 [INF] STREAM: Message store is MEMORY
[1] 2018/08/27 06:19:01.296070 [INF] STREAM: ---------- Store Limits ----------
[1] 2018/08/27 06:19:01.296080 [INF] STREAM: Channels: unlimited
[1] 2018/08/27 06:19:01.296082 [INF] STREAM: --------- Channels Limits --------
[1] 2018/08/27 06:19:01.296084 [INF] STREAM: Subscriptions: 1000 *
[1] 2018/08/27 06:19:01.296085 [INF] STREAM: Messages : 1000000 *
[1] 2018/08/27 06:19:01.296086 [INF] STREAM: Bytes : 976.56 MB *
[1] 2018/08/27 06:19:01.296087 [INF] STREAM: Age : unlimited *
[1] 2018/08/27 06:19:01.296088 [INF] STREAM: Inactivity : unlimited *
[1] 2018/08/27 06:19:01.296090 [INF] STREAM: ----------------------------------
[1] 2018/08/27 07:02:43.476431 [INF] STREAM: Channel "<topic-name>" has been created
# use port-forward to establish a connection for local testing
$ kubectl -n fission port-forward <nats-streaming-pod> 4222:4222
# run test script
$ go run $GOPATH/src/github.com/fission/fission/test/tests/mqtrigger/stan-pub.go -s nats://defaultFissionAuthToken@127.0.0.1:4222 -c fissionMQTrigger -id clientPub <topic-name> ""
# once mqtrigger receives message publishe to the topic, it will trigger function
$ kubectl -n fission logs -f <mqtrigger-pod>
time="2018-08-27T07:02:43Z" level=info msg="Message queue trigger mqt-test created"
time="2018-08-27T07:05:34Z" level=info msg="Making HTTP request to http://router.fission/fission-function/<function name>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.