Skip to main content



      Home
Home » Eclipse Projects » Kura » Kura Cloud Service Subscribe
Kura Cloud Service Subscribe [message #1764241] Sat, 27 May 2017 02:38 Go to next message
Eclipse UserFriend
Hello all,

I wanna ask about subscribing data with cloudservice kura, if i publish data to broker then the data will be subscribed with kura with cloudservice, do I need to send the data from the websocket client as a google protobuf data type or I can just send it to the broker as an usual publishing data ?

thanks for helping,
Iqbal
Re: Kura Cloud Service Subscribe [message #1764357 is a reply to message #1764241] Mon, 29 May 2017 03:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi Iqbal,
probably I've not understood your problem, but I'll try to give you some insights anyway.
The default cloudservice factory in Kura 3.0.0 can be instructed to receive Kura Protobuf or simple JSON data. If not in these formats, the result could be that the message received could not be processed and passed correctly to the proper application.
So, all depends on your cloud part, if the broker/rules set in the remote cloud service is able to manage generic messages and translate them into JSON or Kura Payload, you can have another device publishing in any way it wants. Otherwise, all the devices must speak the same language (i.e. Kura Payload or simple JSON for the default cloud service that Kura Provides).

If you strictly need to speak something different, you can always create your custom Cloud Service stack and install it in Kura.

Best regards,
Matteo
Re: Kura Cloud Service Subscribe [message #1764450 is a reply to message #1764357] Mon, 29 May 2017 22:19 Go to previous messageGo to next message
Eclipse UserFriend
Hello Matteo,

thanks for replying. So from your answer above, I have to convert the massage (that will be subscribed by kura) that I will publish to the broker from my web client with the google protobuf encoding.

and actually I can't yet to use google prtobuf.js to decode the message that published from kura in my javascript web client.

So, I also tried the implementation with DataService. I can use it for publish from kura and subscribe from web client (paho+javascript) successfully. but now my problem is to publish from web client and subscribe from kura. Here is function to publish from web client

function mqtt_Publish_SwitchOn(){
      message = new Paho.MQTT.Message('on');
      message.destinationName = 'lampu/switch';
	  
      MQTT_Client.send(message);
      Set_New_Console_Msg("Published " + "\"" + 'on' + "\"" + " to MQTT Topic: " + "\"" +  message.destinationName + "\"");
	  document.getElementById("status_command").value = "Switched On";
    }


And this is the part of kura for subscribing data

public void onConnectionEstablished() {
		// TODO Auto-generated method stub
		topic_sub = "lampu/switch";
		try{
			m_dataService.subscribe(topic_sub, 1);
			s_logger.info("Subscribed data topic... Done");
		}catch(Exception e){
			s_logger.debug("Subscribing data topic FAILED");
		}
	}


I can successfully published from web client to the broker. But the subscribing method seems not worked based on mosquitto monitoring.
So can you help me for solving this problem for subscribing data from kura ?
Or is there any mistake from both my publishing function and subscribing method ?

I attached the full java (kura) and javascript (web client) file below.

Thanks a lot,
Iqbal
Re: Kura Cloud Service Subscribe [message #1764519 is a reply to message #1764450] Tue, 30 May 2017 14:47 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I think you can have a look at the Kura code to see how subscription is usually done. An example here

You can also have a look at the kura.log file: when the data service performs a subscription, it logs in the log file which is the topic used.

Best regards,
Matteo
Re: Kura Cloud Service Subscribe [message #1764534 is a reply to message #1764519] Wed, 31 May 2017 01:12 Go to previous messageGo to next message
Eclipse UserFriend
Hello Matteo,

Thanks for helping. I solved my problem about DataService above.
But nowI still have a problem, that is I still cant use DataService Kura together with the Kura Web UI. I used the metatype xml form from demo.heater in workspace_archive_2.1.0 bundle.

I can run the kura for publish and subscribe but the form wouldn't appear in kura web UI.

Can you to tell me what files are required to run kura application with web UI ?

Thanks a lot,
Iqbal
Re: Kura Cloud Service Subscribe [message #1764558 is a reply to message #1764534] Wed, 31 May 2017 04:45 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I would suggest having a look at the concept of configurable application: http://eclipse.github.io/kura/dev/configurable_component.html
If you want to integrate into the Cloud Services tab, you need to have a deeper look at the https://github.com/eclipse/kura/tree/develop/kura/org.eclipse.kura.core.cloud and see how we have done it.
Have a look also at this link: https://github.com/eclipse/kura/wiki/Multiple-Cloud-Connections#web-ui-cloud-services

Best regards,
Matteo
Re: Kura Cloud Service Subscribe [message #1765272 is a reply to message #1764558] Wed, 07 June 2017 19:25 Go to previous message
Eclipse UserFriend
Hi Matteo,

Thanks a lot for give me such a great solution. my problem had been solved now.

Thanks,
Iqbal
Previous Topic:measure execution time kura
Next Topic:Kura Modbus Driver
Goto Forum:
  


Current Time: Wed Jul 16 14:48:36 EDT 2025

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

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

Back to the top