Skip to content

Commit

Permalink
Receive an unlimited amount of events
Browse files Browse the repository at this point in the history
* Removes the original cap of 1000 messages.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Dec 17, 2019
1 parent a706770 commit b49818e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Component parts:

See [helm chart](chart/mqtt-connector) for deployment instructions. Then continue at "Test the connector".

```sh
TAG=0.2.0 make build push
```

## Deploy out of cluster

```sh
Expand Down
2 changes: 1 addition & 1 deletion chart/mqtt-connector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Connect OpenFaaS functions to MQTT
name: mqtt-connector
version: 0.1.1
version: 0.2.0
sources:
- https://github.com/openfaas-incubator/mqtt-connector
home: https://www.openfaas.com
Expand Down
2 changes: 1 addition & 1 deletion chart/mqtt-connector/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: alexellis2/mqtt-connector:0.1.6
image: alexellis2/mqtt-connector:0.2.0
replicas: 1

# Emitter.io example
Expand Down
6 changes: 2 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func main() {
id := flag.String("id", "testgoid", "The ClientID (optional)")
cleansess := flag.Bool("clean", false, "Set Clean Session (default false)")
qos := flag.Int("qos", 0, "The Quality of Service 0,1,2 (default 0)")
num := flag.Int("num", 1000, "The number of messages to publish or subscribe (default 1)")

flag.Parse()

Expand Down Expand Up @@ -98,7 +97,7 @@ func main() {
os.Exit(1)
}

for receiveCount < *num {
for {
incoming := <-choke

topic := incoming[0]
Expand All @@ -117,8 +116,7 @@ func main() {
receiveCount++
}

client.Disconnect(250)
fmt.Println("Sample Subscriber Disconnected")
client.Disconnect(1250)
}

// ResponseReceiver enables connector to receive results from the
Expand Down

0 comments on commit b49818e

Please sign in to comment.