mqtt
- MQTT for kdb+This interface lets you communicate with an MQTT broker from a kdb+ session. The interface follows closely the PAHO MQTT C API. Exposed functionality includes
This is part of the Fusion for kdb+ interface collection.
Kdb+ is the world’s fastest timeseries database, optimized for ingesting, analyzing and storing massive amounts of structured data. To get started with kdb+, please visit https://code.kx.com/q/learn/ for downloads and developer information. For general information, visit https://kx.com/
Message Queueing Telemetry Transport (MQTT) is a machine-to-machine/IOT connectivity protocol. It is designed to provide a lightweight publish/subscribe messaging protocol.
MQTT is used commonly for constrained devices with low-bandwidth, high-latency or unreliable networks.
This messaging protocol is used extensively where a small software footprint is required, e.g.
:globe_with_meridians: MQTT: Real-world applications
:point_right: API reference
:point_right: Install guide
:point_right: The underlying Paho MQTT library provides the ability to log diagnostic information to standard out or log files via an environment variable as detailed here
:point_right: Building guide
To run the examples you will need a MQTT broker e.g.
Start Mosquitto on default port localhost:1883
.
sudo systemctl start mosquitto
We assume you are in the source directory of the MQTT-kdb+ interface.
mqtt]$ cd q
q]$ q ../examples/consumer.q
In the same directory as the one launching a consumer, run:
q]$ q ../examples/producer.q
Then pubish a message by a timer, say every second:
q)\t 1000
Going back to the console of consumer, now you can see received messages in .mqtt.tab
:
q).mqtt.tab
topic msg_sent msg_recv received_m..
-----------------------------------------------------------------------------..
topic1 2021.01.06D13:24:46.267356000 2021.01.06D13:24:46.267718000 topic1_3 ..
topic2 2021.01.06D13:24:46.267450000 2021.01.06D13:24:46.368412000 topic2_3 ..
topic1 2021.01.06D13:24:47.267366000 2021.01.06D13:24:47.268676000 topic1_4 ..
topic2 2021.01.06D13:24:47.267624000 2021.01.06D13:24:47.372268000 topic2_4 ..
topic1 2021.01.06D13:24:48.276623000 2021.01.06D13:24:48.277677000 topic1_5 ..
topic2 2021.01.06D13:24:48.276801000 2021.01.06D13:24:48.377926000 topic2_5 ..
topic1 2021.01.06D13:24:49.267324000 2021.01.06D13:24:49.268228000 topic1_6 ..
topic2 2021.01.06D13:24:49.267482000 2021.01.06D13:24:49.368805000 topic2_6 ..
topic1 2021.01.06D13:24:50.267684000 2021.01.06D13:24:50.268125000 topic1_7 ..
topic2 2021.01.06D13:24:50.267804000 2021.01.06D13:24:50.368889000 topic2_7 ..
The interface is currently available under an Apache 2.0 license and is supported on a best-efforts basis by the KX Fusion team. The interface is currently in active development, with additional functionality released on an ongoing basis.
:point_right: Issues and feature requests
:point_right: Guide to contributing