Documentation

Integrations / Connection guides / MQTT brokers

MQTT brokers

The Blockbax Platform can directly connect with an MQTT broker. In this guide we will show you how you can set up integrations to let your data (such as measurements and events) flow in and out of an MQTT broker. In this tutorial we use the HiveMQ as an example. This guide should be usable for self-hosted or other managed MQTT brokers as well, in case you need help contact us.

Goal

The goal is to set up an inbound and outbound integration between an MQTT broker and Blockbax.

Prerequisites
  • Blockbax project (with administrator access)
  • Access to an MQTT broker
Steps to stream data from HiveMQ to Blockbax

Several steps in both HiveMQ and Blockbax are needed to get the data from your MQTT broker to Blockbax.

  1. Go to ‘ACCESS MANAGEMENT’ and create credentials, give it the permission ‘Subscribe Only’, or give it a custom permission to just include part of a topic
  2. Go to ‘OVERVIEW’ and keep it open as a separate tab to copy over the settings in a later step

With the account created we can now set up the connector in Blockbax

  1. Go to settings in the project
  2. Navigate to the tab ‘Inbound connectors’ and click on the green ‘+’ in the top right
  3. In the setting ‘Protocol’ select the option ‘MQTT subscribe’
  4. Choose a suitable name for the inbound connector
  5. Copy over the settings from the other tab to the inbound connector
    Create mqtt subscribe inbound connector
  6. Write a payload conversion script to convert the incoming payload to the correct Blockbax format. More information can be found here. Note that you do have access to the context#getTopic() method.
  7. Click the ‘Create connector’ and validate if the ‘Successfully (re)connected inbound connector, will start processing measurements.’ log shows up. This can take up to 30 seconds. If you encounter any issues feel free to contact us
Create an outbound connector in Blockbax

This can be enabled on request. Please contact us if you want us to set this up for you.