Faas: MQTT Connector

Created on 29 May 2019  路  16Comments  路  Source: openfaas/faas

I'm looking to run OpenFaaS and trigger functions from MQTT topics (they already exist, so the name of the topics has to be completely custom). I've been doing a lot of searches and I can't find much details on any MQTT connectors for OpenFaas. MQTT is displayed in one picture in the docs, but the only relevant information I can find is to set up a connector with Kafka, but that's rather overkill for my use case, I'm looking for a simple setup that I can run on Raspberry Pi.

So my question is, how would I trigger a function from a MQTT topic?

question support

Most helpful comment

Here's our official MQTT connector, it was required for a commercial project and so it gave a good reason to build it for the community.

https://github.com/openfaas-incubator/mqtt-connector

Connecting drone event data to Postgres / Mapbox:

https://github.com/packet-labs/iot

All 16 comments

Hi @HakanL,

The connectors that are available from the project and community are displayed in the docs under "triggers" https://docs.openfaas.com/reference/triggers/

You'll also see a link for how to build an MQTT connector using the OpenFaaS connector-sdk. I would suggest you either use this to build your own or reach out to OpenFaaS Ltd if you'd like to comission the work via [email protected]

Does this answer the question?

Alex

Derek add label: support

Derek add label: question

Yea that's the information I found too, but since I saw MQTT in the picture there I was surprised that nobody had implemented a connector like that before, it seems like it would be a very common use case (I may be wrong on that of course), thinking maybe I overlooked or misunderstood something. I'll look at the Connector SDK, thanks for pointing me in the right direction and I think we can close this question/issue.

Let me know how you want to proceed.

I'll close the question since it's been answered now. Feel free to keep commenting or join Slack to chat to the community.

You may find this interesting which is an MQTT broker written in Python:

https://github.com/alexellis/iot-sensors-mqtt-openfaas/blob/master/mqtt-broker/app.py

@HakanL I'm also interested in an MQTT connector, and have found https://github.com/eclipse/paho.mqtt.rust which is MQTT->Redis

@robmarkcole I wrote a connector for MQTT, but there's more work needed to update the readme, etc before it's ready to be put up here.

@HakanL waiting for your connector, not ready yet? :(

If anyone has a pressing business need for this please do get in touch with me so see how we can help.

@HakanL waiting for your connector, not ready yet? :(

I started building it, but the business need changed so I never finished, sorry :(

I have created a simple MQTT connector: f43i4n/faas-mqtt-connector
It currently only has basic MQTT functionality and few configuration options, but it may fulfil your needs or you could create a PR to improve the connector.

Here's our official MQTT connector, it was required for a commercial project and so it gave a good reason to build it for the community.

https://github.com/openfaas-incubator/mqtt-connector

Connecting drone event data to Postgres / Mapbox:

https://github.com/packet-labs/iot

@f43i4n is there anything in your connector that you'd like to contribute back? Can our new connector do everything you needed? cc @HakanL @amirmhp98 @robmarkcole

I'm no longer working on the project that needed this, but based on a quick glance it seems what you've released should work. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hotjunfeng picture hotjunfeng  路  5Comments

ohld picture ohld  路  6Comments

edouardkleinhans picture edouardkleinhans  路  8Comments

matthewdolman picture matthewdolman  路  5Comments

alexellis picture alexellis  路  6Comments