Documentation

FairCom EDGE IoT Database

Previous Topic

Next Topic

MQTT Plug-in

The FairCom EDGE database includes an MQTT Plug-in that transforms the hub into an MQTT Broker with the ability to cache MQTT messages in relational tables for easy integration with other systems.

This chapter is a brief MQTT reference to get you started quickly.

MQTT, or Message Queuing Telemetry Transport, is a lightweight protocol allowing small pieces of data to be transferred from machine to machine across networks. MQTT works well even on low bandwidth, high latency connections, which makes it ideal for the Internet of Things (IoT).

MQTT communication consists of a publisher, a broker, and a subscriber:

  • A subscriber connects to a broker and registers for a particular topic (a UTF-8 string used by the broker to filter messages for each connected client).
  • A publisher connects to a broker and sends a message tagged with a particular topic.
  • The broker receives the message and sends it to any subscribers who have subscribed to that topic.

Any number of publishers can be sending messages on one or more topics. Any number of subscribers can be listening for one or more topics. All messages for a particular topic will be sent to all clients subscribed for that topic regardless of where they were sent from. The broker, publisher, and subscriber can be on the same machine or different machines.

The FairCom EDGE MQTT Broker is a generic broker for connecting c-tree as a persistent data store under an MQTT application. It can be placed on smaller devices and gateways typically found near the sensors. It is used to persist MQTT message contents on the edge. By locating FairCom EDGE on the edge, MQTT message contents can be persisted near the sensors where service is unaffected by the latency of the cloud.

Any of the JSON fields contained in a specified topic can be written automatically to a specified database table. This table is simultaneously available via a FairCom DB SQL server allowing ISAM and SQL connections to the persisted fields. Data continues to flow through the FairCom EDGE Broker normally, going from publisher to subscriber while, at the same time, being stored in a database. Configure as many tables as you want each one collecting fields from different topics.

This allows full SQL access to some or all fields of data moving through the FairCom EDGE MQTT Broker with very little change to standard MQTT setups.

MQTT uses System Topics to control its operation. These topics provide a variety of metadata about the operation of the queue as well as the location of a configuration file. This mechanism can be used to determine which topics will be persisted.

For more MQTT information, see mqtt.org.

Let's get started:

You will find important information about MQTT configuration in Configuring the MQTT Plug-in.

For an MQTT tutorial explaining messages and persistence topics, see Tutorial for MQTT: Configuring a Persistence Topic.

For using MQTT with Node-RED, see the section titled Node-RED Using the FairCom EDGE MQTT Broker.

Additional information for Python developers using FairCom EDGE is provided in Python Using FairCom EDGE MQTT.

Note: For reference information about the supported MQTT operations, see the FairCom MQTT Reference Guide in the on-line documentation.

TOCIndex