Sign inSign up

astaykov/mqtt-bridge

By astaykov

•Updated over 8 years ago

Bridge a generic MQTT Server with Azure IoT Hub

Image
0

1M+

astaykov/mqtt-bridge repository overview

⁠Simple MQTT to Azure IoT Hub Bridge container

This is a very simple project - bridge a generic MQTT Broker (say a specific topic) to an Azure IoT Hub.

⁠References

This project is based on two main sources:

⁠Configuration

The generic MQTT client part as well as IoT Hub Connection string are configured over the following environment variables:

  • DEVICE_CONNECTION_STRING - your IoT Hub Device Connection String
  • MQTT_SERVER - full address of your MQTT Server (i.e. mqtt://test.mosquitto.org:1883)
  • MQTT_TOPIC - relative address of your MQTT Topic (i.e. /v1/flex/001F4808EA60/interesting_events)

⁠Source Code

The source code for the image is published on GitHub⁠

⁠Run it on Azure Container Instance (ACI)

You can quickly test the bridge with the following command

az container create -g <RESOURCE_GROUP> -n <NAME_OF_THE_SERVICE> -e 'DEVICE_CONNECTION_STRING=<YOUR_CONN_STRING>' 'MQTT_SERVER=<MQTT_SERVER>' 'MQTT_TOPIC=<MQTT_TOPIC>' --image astaykov/mqtt-bridge --cpu 1 --memory 0.5

Where the placeholders have following meaning

  • <RESOURCE_GROUP> - name of an existing resource group to place the container intance into
  • <NAME_OF_THE_SERVICE> - name of the Azure Container Instance reosurce you are going to create
  • <DEVICE_CONNECTION_STRING> - your IoT Hub Device Connection String
  • <MQTT_SERVER> - full address of your MQTT Server (i.e. mqtt://test.mosquitto.org:1883)
  • <MQTT_TOPIC> - relative address of your MQTT Topic (i.e. /v1/flex/001F4808EA60/interesting_events)

⁠TODO

Enhance MQTT Client to support secured MQTT connections (requires importing of server certificates).

Tag summary

Content type

Image

Digest

Size

31.7 MB

Last updated

over 8 years ago

docker pull astaykov/mqtt-bridge