openfaas / mqtt-connector Goto Github PK
View Code? Open in Web Editor NEWMQTT connector for OpenFaaS
License: MIT License
MQTT connector for OpenFaaS
License: MIT License
Is it possible to set the "qos:1" and "clean:true" attributes in value.yaml?
I don't know go language,help
This connector cannot deal with more than one MQTT topic, as stated in https://github.com/openfaas/mqtt-connector/tree/master/chart/mqtt-connector and confirmed by my own tests with the connector. This seems normal as only one MQTT subscription is created. I'm wondering why this connector is limited to one single topic per instance.
Only one topic is allowed. If more than one topic are used (e.g. my-topic,my-second-topic
), no errors are thrown but only the first topic seems to be used. Only messages published to the first topic my-topic
will be received by the connector.
I've added very simple multi-topic support using multiple subscriptions, but maybe I'm missing how the connector-sdk
handles/splits the topic internally.
FaaS-CLI version ( Full output from: faas-cli version
):
commit: c12d57c39ac4cc6eef3c9bba2fb45113d882432f
version: 0.12.14
Docker version docker version
(e.g. Docker 17.0.05 ): Docker 19.03.12
Are you using Docker Swarm or Kubernetes (FaaS-netes)? No
Operating System and version (e.g. Linux, Windows, MacOS): Linux
Published an image in to "/testmqtt/pushimage1" MQTT topic
It will trigger another function "mqttsubscribeimage"
"received_image.jpg" should be expected inside the pod
Not able to find the "received_image.jpg".
mqttsubscribeimage function handler code (handler.py) (python3-flask-debian docker file used)
.........................................................................................
from PIL import Image
import io
import json
import os
import uuid
import time
import paho.mqtt.client as mqtt
def on_message(client, userdata, message):
open('received_image.jpg','wb').write(message.payload)
def handle(req):
client = mqtt.Client("ipaddress_of_my_system:1883", transport="tcp")
broker = "ipaddress_of_my_system"
port = 1883
client.connect(broker, port)
print("connected to broker")
client.loop_start()
client.subscribe("/testmqtt/pushimage1")
client.on_message = on_message
time.sleep(1000)
client.loop_forever()
return req
requirements.txt file
.......................................................
paho-mqtt
pillow==7.0.0
In mqttsubscribeimage function logs
..................................................................................
I can see only --> POST / - 200 OK - ContentLength: 50223
Running inside Minikube
Upgrade to Go 1.18 in GitHub Actions and Dockerfile
Currently on Go 1.15
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.