Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » How to publish MQTT messages with a Kura component?
How to publish MQTT messages with a Kura component? [message #1836949] Tue, 19 January 2021 17:04 Go to next message
Max Mueller is currently offline Max MuellerFriend
Messages: 9
Registered: November 2020
Junior Member
Hi,

this seems to be a very simple question, but I'm stuck with that for a longer time. Also just googling "kura publish MQTT" brings no satisfying results.

I want to publish MQTT messages with an individual JSON format on an individual topic.

In docu is the heater demo bundle as an example publishing application. It uses CloudService / CloudPublisher for publishing the messages.

It can only publish on the topic: <account-name>/<client-id>/heater/data and it can only publish KuraPayload with metrics which are always in the format:
{ 
  "metrics": { 
    "String name" : "Object Value",   
  } 
} 

Is there a way to change topic and metrics using CloudService? Or is CloudService only for communication with a remote Kura server and I must use DataService? But then I'm wondering why there is not a single example using DataService.

Thanks,
Max
Re: How to publish MQTT messages with a Kura component? [message #1836989 is a reply to message #1836949] Wed, 20 January 2021 15:41 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 423
Registered: July 2015
Location: Italy
Senior Member
Hi,
the best option would be to create your version of the cloud connector. So that you can change your format for the message.
If you want to use the default connector, you can try to use the data service API and provide directly the formatted message as a byte[]. But you will lose all the advantages provided by the publish API, support for Wires, etc.

Best regards,
Matteo
Re: How to publish MQTT messages with a Kura component? [message #1837997 is a reply to message #1836989] Fri, 12 February 2021 11:47 Go to previous message
Max Mueller is currently offline Max MuellerFriend
Messages: 9
Registered: November 2020
Junior Member
If somebody found this thread and wants to use the DataService, there is a good example on how to publish MQTT messages via DataService:
https://stackoverflow.com/a/31761816/14940207

Thanks Matteo for your help
Previous Topic:dpp file generated empty
Next Topic:Publish high rate messages with DataService without H2DbService
Goto Forum:
  


Current Time: Wed Dec 04 03:11:14 GMT 2024

Powered by FUDForum. Page generated in 0.04823 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top