IoT agents are responsible for receiving messages from physical devices (directly or through a gateway) and sending them commands in order to configure them. This iotagent-mosca, in particular, receives messages via MQTT with JSON payloads.
How does it work¶
iotagent-mosca depends on a Kafka broker, so that it can receive messages informing it about new devices (and, in extension, about their updates and removals). It listens to device management topics on Kafka and for MQTT messages using its internal broker implemented by Mosca library. For more information about the internals of this mechanism, check iotagent-nodejs documentation.
How to build¶
As this is a npm-based project, building it is as simple as
And that’s all.
How to run¶
As simple as:
Remember that you should already have a Kafka node (with a zookeeper instance).
How do I know if it is working properly?¶
Simply put: you won’t. In fact you can implement a simple Kafka publisher to emulate the behaviour of a device manager instance and a listener to check what messages it is generating. But it seems easier to get the real components - they are not that hard to start and to use (given that you use dojot’s docker-compose). Check also DeviceManager documentation for further information about how to create a new device.