Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
persist nodes
December 1, 2020
15:59, EET
Avatar
rblu
Member
Members
Forum Posts: 3
Member Since:
November 27, 2020
sp_UserOfflineSmall Offline

persit nodes as json/byte[]/db/anything

Hallo Community and Supporters,

at the moment i am developing a server application with the SDK version 4.4.2-1266. I managed to get the server up and running and reading nodes is no problem either. one of the current requirement of the software is that it should be able to persist data in anyway or fashion to a database.

My Problem:
I am not able to identify a way to achieve this goal.

What i tried so far:
– Serialization is not possible since the UaNode and its subtypes are not Serializable.
– converting them to a bytestream does fail for the same reason.
– Marshalling with JAXB
– JsonEncoder(com.prosysopc.ua.stack.encoding.json.JsonEncoder) does produce empty output, but maybe i am using it the wrong way

Is there any resource available which provide information on this topic?
Are there any examples on how to use the JsonEncoder?

Thanks in advance and best regards!

December 2, 2020
12:13, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 346
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

At the moment, the Prosys OPC UA SDK for Java doesn’t provide any built-in tools for persisting Nodes. I would recommend you to take a look at MyBigNodeManager class of the SampleConsoleServer sample application for an example of how to implement a NodeManager that gets its data from an underlying system. In the example the data is generated in the code with simple mathematical formula, but it could also be fetched from a database or an XML file.

However, this approach will require implementing features such as writing Values to Nodes manually. What would your application do with the Nodes you need to persist during its runtime?

December 2, 2020
12:53, EET
Avatar
rblu
Member
Members
Forum Posts: 3
Member Since:
November 27, 2020
sp_UserOfflineSmall Offline

Hello Matti,

thanks for your fast response. The application is planned to be a prototype for a large scale application with multiple OPC-servers and database clusters in the background. Syncing databases is normally not a big problem for the most cases. The main problem is that the servers each are not holding all the data at all time, since it would be to much(we are talking about terabytes of data in the test scenario) and therefore the OPC-servers should “request” needed nodes at the db-clusters on-demand.
Best regards!

December 2, 2020
14:10, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 346
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

Since you’re dealing with such vast volumes of data, I would recommend you to base your solution on MyBigNodeManager and have it interact with the databases.

December 2, 2020
14:52, EET
Avatar
rblu
Member
Members
Forum Posts: 3
Member Since:
November 27, 2020
sp_UserOfflineSmall Offline

Hello Matti,
Thank you for your help, i will try to resolve the problem with the MyBigNodeManager solution.

On an additional note:
is the JsonEncoder currently working or is it not “released” yet?

December 2, 2020
17:12, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

The XXXEncoder and XXXDecoders within package com.prosysopc.ua.stack.encoding.XXX purpose is to encode/decode classes that have (and are used in) OPC UA Part 6 defined encodings. They are not something that would work on UaNodes (nothing is). They would work on the Value Attribute’s value of the node though, since they are something that have Part 6 encodings defined to them.

Using UaNodes requires in practice that all of them can be kept at memory all times in the current SDK design (i.e. the references are directly in the nodes referencing other nodes), thus using the MyBigNodeManager-style is basically the only way at the moment for you (since it wont use UaNodes and instead you must provide Attribute and Reference data “somehow” when requested by the SDK). Preferably at some point in the future we can have a better way to combine the 2 strategies.

The current primary purpose for the JsonEncoder is in conjunction with our PubSub MQTT+JSON support. Though in general it should still work the same way as BinaryEncoder for the Part 6 encoding purposes.

Also note that we do not (and wont have in a while) have a counterpart JsonDecoder, because building one is hard for our current architecture for the encoder/decoders. Basically before the JSON encoding was defined in OPC UA 1.04, the Binary and XML have clearly defined sequential ordering for the Structure fields (the order they are defined). However, JSON by the very nature of JSON means non-ordered set of key-value parts, thus it is not suitable the way we do it currently. Since any order is allowed, we can encode them in the sequential order, just that we would have no guarantee that we would receive such JSON back.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 735

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1