Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Need help to connect broker to kura and receive data into h2db(Existing broker connect to RPi Gateway with Kura and receive data via MQTT into H2 built-in database)
Need help to connect broker to kura and receive data into h2db [message #1780136] Wed, 17 January 2018 22:04 Go to next message
Amal Kederoglu is currently offline Amal KederogluFriend
Messages: 7
Registered: January 2018
Junior Member
Hey everybody,
i have following scenario:
I have a broker with sensor data and i need to receive this data with my kura gateway and persist them into the h2db ( kura-built-in db)

How to configure kura to realize what i´ve mentioned above?
Thank you in advance.
Re: Need help to connect broker to kura and receive data into h2db [message #1780482 is a reply to message #1780136] Tue, 23 January 2018 07:43 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Hi,
where is this broker running? In Kura or elsewhere?

Best regards,
Matteo

[Updated on: Tue, 23 January 2018 07:44]

Report message to a moderator

Re: Need help to connect broker to kura and receive data into h2db [message #1780497 is a reply to message #1780482] Tue, 23 January 2018 12:32 Go to previous messageGo to next message
Amal Kederoglu is currently offline Amal KederogluFriend
Messages: 7
Registered: January 2018
Junior Member
Hi Matteo

The broker is running in somewhere else and the datas are like this:

URL de.einstein.lab.col
Port: 2883
Topic: xx/alldata/#
Username: uname
Password: pword

Thank you in advance.

Best regards
Amal
Re: Need help to connect broker to kura and receive data into h2db [message #1780498 is a reply to message #1780497] Tue, 23 January 2018 12:35 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Ok, so if you want to use Wires you have the subscriber component that can fetch the data from the remote broker.
Attached to this you can have the DB component that will be connected to the subscriber and will receive the messages and store them in Kura's database instance.

If you, instead, want to develop your own Java application, you should have a look at the CloudClient component and start from there.

Best regards,
Matteo
Re: Need help to connect broker to kura and receive data into h2db [message #1780499 is a reply to message #1780498] Tue, 23 January 2018 13:17 Go to previous messageGo to next message
Amal Kederoglu is currently offline Amal KederogluFriend
Messages: 7
Registered: January 2018
Junior Member
thanks for your quick answer.
Ok, i will try kura wires and your description, but i am a beginner in working with kura.
Is there any tutorial what i can follow?

Another thing is:

I am working on a webserver with Spring and i want to connect to the H2DB Instance of Kura on my raspberry PI and my application.properties are:

java.version=1.8
# Datasource
spring.datasource.url = jdbc:h2:tcp://<ip-adress:port>/~/opt/db/mydb;
spring.datasource.username = sa
spring.datasource.password =
spring.datasource.driverClassName = org.h2.Driver
spring.jpa.hibernate.ddl-auto = create
#spring.jpa.hibernate.ddl-auto = update
#H2 Web Console (H2ConsoleProperties)
#spring.h2.console.path=/h2-console # Path at which the console is available.
#spring.h2.console.settings.trace=false # Whether to enable trace output.
spring.h2.console.settings.web-allow-others=true
spring.h2.console.enabled=true


Where should i give my ssh credentials to connect with my raspberry?

Thank you.
BRegards
Amal
Re: Need help to connect broker to kura and receive data into h2db [message #1780500 is a reply to message #1780499] Tue, 23 January 2018 13:29 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
I would suggest you to have a look at the Kura official documentation: https://eclipse.github.io/kura/

There are a lot of examples on Kura Wires, on developing plain java applications and also examples on the database.

Best regards,
Matteo
Re: Need help to connect broker to kura and receive data into h2db [message #1781286 is a reply to message #1780500] Mon, 05 February 2018 14:38 Go to previous messageGo to next message
Amal Kederoglu is currently offline Amal KederogluFriend
Messages: 7
Registered: January 2018
Junior Member
Hey Matteo,
now i´m able to subscribe and publish to my broker (broker running elsewhere).

if i use the publlish() method as its used in the kura_heater_demo it persists in H2DB. I found that the reason for that is the store() method of the DataServieImpl-Class.
Now my question/problem:

(1) if i use only the store() method, the database does not get any data. What is my mistake in this?

(2) Should i use DataServiceImpl - Class in my bundle ( i mean a instance of DataServiceImpl ) to create new tables in my H2DB and persist data into it?
Please could you give me steps to use DataServiceImpl-Class in my Bundle, because it gave me back "connection refused"

Thanks in advance.
Greetings Amal.
Re: Need help to connect broker to kura and receive data into h2db [message #1781353 is a reply to message #1781286] Tue, 06 February 2018 10:36 Go to previous message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 264
Registered: July 2015
Location: Italy
Senior Member
Hi,
the persistence in db in case of publish is only for the time that the data has to be waiting before sending to the cloud.
If you want to use directly the db in your application, you need to get the specific H2db service instance and use the corresponding primitives.
Again, you can use wires to do that, since there exists a specific db component.

Best regards,
Matteo
Previous Topic:Kura wires to subscribe data from extern broker
Next Topic:How to write/add tabs in a configurable bundle
Goto Forum:
  


Current Time: Sun Sep 23 20:38:47 GMT 2018

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

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

Back to the top