cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
19247
Views
2
Helpful
3
Replies

Kinetic EFM connect MQTT Devices via Mosquitto Broker

tobias.hirt
Level 1
Level 1

Hello,

we are currently building a demo using EFM and we want to connect our sensor devices to the EFM Broker.

Our devices send their data via MQTT to a Mosquitto broker on the same machine the EFM Broker is running on.

How do we connect the Mosquitto Broker as a downstream to the EFM Broker?

We tried to use the MQTT DS-Link and set the the broker variable in the configuration to http://127.0.0.1:1883 but when we start the link the state switches between started and stopped.

The log of the test DS link:

DS Link Log

[2018-03-05 11:56:10.717405] == Executing bash with arguments [/opt/cisco/kinetic/efm_server/dslinks/XDK Test/bin/dslink-java-mqtt, --name, mqtt, --nodes, nodes.json, --key, .key, --log, debug, --broker, http:127.0.0.1:1883, --token, xJUjpMDdfSFpH3T1ufOchWSgMX5QVmUchqxfeQKPgTZ8m6wV] (pid: 4196) ==

[2018-03-05 11:56:11.676485] Exception in thread "main" java.lang.NoClassDefFoundError: java.nio.file.Path

[2018-03-05 11:56:11.676526]    at com.beust.jcommander.internal.DefaultConverterFactory.<clinit>(DefaultConverterFactory.java:66)

[2018-03-05 11:56:11.676539]    at java.lang.Class.initializeClass(libgcj.so.16)

[2018-03-05 11:56:11.676551]    at com.beust.jcommander.JCommander.<clinit>(JCommander.java:167)

[2018-03-05 11:56:11.676559]    at java.lang.Class.initializeClass(libgcj.so.16)

[2018-03-05 11:56:11.676644]    at org.dsa.iot.dslink.config.Arguments.parse(Arguments.java:143)

[2018-03-05 11:56:11.676656]    at org.dsa.iot.dslink.config.Configuration.autoConfigure(Configuration.java:285)

[2018-03-05 11:56:11.676667]    at org.dsa.iot.dslink.DSLinkFactory.generate(DSLinkFactory.java:51)

[2018-03-05 11:56:11.676675]    at org.dsa.iot.dslink.DSLinkFactory.start(DSLinkFactory.java:26)

[2018-03-05 11:56:11.676683]    at org.dsa.iot.mqtt.Main.main(Main.java:105)

[2018-03-05 11:56:11.690094] == Exited with status 1 ==

[2018-03-05 11:56:11.676485] Exception in thread "main" java.lang.NoClassDefFoundError: java.nio.file.Path

[2018-03-05 11:56:11.676526]    at com.beust.jcommander.internal.DefaultConverterFactory.<clinit>(DefaultConverterFactory.java:66)

[2018-03-05 11:56:11.676539]    at java.lang.Class.initializeClass(libgcj.so.16)

[2018-03-05 11:56:11.676551]    at com.beust.jcommander.JCommander.<clinit>(JCommander.java:167)

[2018-03-05 11:56:11.676559]    at java.lang.Class.initializeClass(libgcj.so.16)

[2018-03-05 11:56:11.676644]    at org.dsa.iot.dslink.config.Arguments.parse(Arguments.java:143)

[2018-03-05 11:56:11.676656]    at org.dsa.iot.dslink.config.Configuration.autoConfigure(Configuration.java:285)

[2018-03-05 11:56:11.676667]    at org.dsa.iot.dslink.DSLinkFactory.generate(DSLinkFactory.java:51)

[2018-03-05 11:56:11.676675]    at org.dsa.iot.dslink.DSLinkFactory.start(DSLinkFactory.java:26)

[2018-03-05 11:56:11.676683]    at org.dsa.iot.mqtt.Main.main(Main.java:105)

[2018-03-05 11:56:11.690094] == Exited with status 1 ==

[2018-03-05 11:56:11.676485] Exception in thread "main" java.lang.NoClassDefFoundError: java.nio.file.Path

[2018-03-05 11:56:11.676526]    at com.beust.jcommander.internal.DefaultConverterFactory.<clinit>(DefaultConverterFactory.java:66)

[2018-03-05 11:56:11.676539]    at java.lang.Class.initializeClass(libgcj.so.16)

[2018-03-05 11:56:11.676551]    at com.beust.jcommander.JCommander.<clinit>(JCommander.java:167)

[2018-03-05 11:56:11.676559]    at java.lang.Class.initializeClass(libgcj.so.16)

[2018-03-05 11:56:11.676644]    at org.dsa.iot.dslink.config.Arguments.parse(Arguments.java:143)

[2018-03-05 11:56:11.676656]    at org.dsa.iot.dslink.config.Configuration.autoConfigure(Configuration.java:285)

[2018-03-05 11:56:11.676667]    at org.dsa.iot.dslink.DSLinkFactory.generate(DSLinkFactory.java:51)

[2018-03-05 11:56:11.676675]    at org.dsa.iot.dslink.DSLinkFactory.start(DSLinkFactory.java:26)

[2018-03-05 11:56:11.676683]    at org.dsa.iot.mqtt.Main.main(Main.java:105)

[2018-03-05 11:56:11.690094] == Exited with status 1 ==

[2018-03-05 11:56:12.812992] == Executing bash with arguments [/opt/cisco/kinetic/efm_server

3 Replies 3

Steve Zhang
Cisco Employee
Cisco Employee

Hi Tobias,

Please use the format of "tcp://10.11.12.13" instead of "http://x.x.x.x" for connecting MQTT Broker with MQTT DSLink.

Thanks,

Steve

Hello,

we got the connection with the Mosquitto broker working.

Currently there are 2 sensors publishing to the broker with the topic MultiKit / [ID of Sensor].

We subscribed to the topic MultiKit/# to get all sensors.

Dataflow Editor2.png

When I drag and drop the topic MultiKit from the Data folder I get the following table.

Dataflow Editor.png

The next step would be to get the data for each sensor, process it (the data is a json string) and save it in our database.

But how do we get access to the data of each sensor via efm? I could drag and drop each sensor data from the Metrics tab into the dataflow editor, but that would mean I had to edit the dataflow every time a new sensor would be added. That doesn't seem practical.

Hello,

EFM supports to drag and drop the specific data, and the general data/operations also in Dataflow. For example, you may select a MQTT broker, right click to get "Publish", and drag and drop "Publish" to Dataflow. And then you may define some block for the topic and value for "Publish". The same methodology may apply for Subscribe, get the subscribed data, and others.

For details, please refer to Cisco Kinetic EFM Dataflow Editor User Guide at Cisco Edge Fog Fabric - End-User Guides - Cisco.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: