15:59, EET
November 27, 2020
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!
12:13, EET
Moderators
February 11, 2020
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?
12:53, EET
November 27, 2020
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!
14:10, EET
Moderators
February 11, 2020
14:52, EET
November 27, 2020
17:12, EET
April 3, 2012
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.
Most Users Ever Online: 1919
Currently Online:
35 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: 727
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardoModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1