-
Notifications
You must be signed in to change notification settings - Fork 313
Subscribing data to in built MQTT Server and sending data to Cloud Platform (Kapua)
This is still in development phase!!
Documentation (to create a program) which could help in the below :
- Connect/ subscribe to the in-built MQTT Server (or any MQTT Server) from Kura.
- Subscribe to the specific topics.
- Convert the messages to Kura-payload
- Send the kura-payload to Kapua (Probably, Example Publisher can be referred here)
1. Connect/ subscribe to the in-built MQTT Server:
We can use two Cloud Connection Factor PID:
- "org.eclipse.kura.cloud.CloudService" and
- "org.elclipse.kura.cloudconnection.eclipseiot.mqtt.ConnectionManager"
Both two factories can be used to connect to Mqtt brokers. The difference between them is that they use different mqtt namespaces. Also, Eclipse IoT integration connection does not support custom subscriptions which is why, we would not see Subscriber available when Eclipse IoT integration connection is selected as cloud connection.
To connect to the internal broker, we have to instantiate a new cloud connection. For example
- A new instance of "org.eclipse.kura.cloud.CloudService" (Cloud Connections -> New Connection --> Cloud Connection Factory PID)
- Point it to mqtt://127.0.0.1:1883.
2. Subscribe to the specific topics
- To get messages from that connection, you'll have to instantiate a new subscriber.
- Then you can use, for example, wire components to process the message and publish it to another cloud service.
Something missing here; How to see the messages in Java Program? or Wires? or Database?
2a Data Format:
Data which is sent to the MQTT Server has to be of a certain format. Default cloud connection supports both KuraProtobuf and simple JSON. The choice between the two is done in CloudService configuration.
User Documentation: https://eclipse-kura.github.io/kura/. Found a problem? Open a new issue or start a discussion.