OPCFoundation / UA-Java-Legacy

This repository is provided by OPC Foundation as legacy support for an Java version for OPC UA.
https://github.com/OPCFoundation/UA-.NETStandard
Other
354 stars 226 forks source link

How to pubhlish from the OPS UA Java SDK? #233

Closed nc-jeni closed 1 year ago

nc-jeni commented 1 year ago

In continuation of https://github.com/OPCFoundation/UA-Java-Legacy/issues/88, I understand that it is required to call the "Publish" service and the server will return a notification (if available) in the response otherwise no notifications are received.

I have created the subscription and added it to the client Added items of type MonitoredDataItem to the subscription. Enabled publishing on the subscription.

        DataChangeFilter dataChange = new DataChangeFilter();
        dataChange.setTrigger(DataChangeTrigger.StatusValue);
        MonitoredDataItem dataItem =
                new MonitoredDataItem(nodeId, Attributes.Value, MonitoringMode.Reporting, subscription.getPublishingInterval());
        dataItem.setDataChangeListener(dataChangeListener);
        dataItem.setDataChangeFilter(dataChange);

        MonitoredItemCreateResult r = subscription.addItem(dataItem);

        subscription.setPublishingEnabled(true);

Now, the question is how to publish? On the UaClient, I am able to find the getSession(), but I cannot find any publish or publish-like methods on the session?

Hope anyone will be able to help me here?

TIA

jouniaro commented 1 year ago

It seems that you are using Prosys OPC UA SDK for Java, so I recommend you contact Prosys OPC via their forum. This Github project is only for the OPC Foundation's OPC UA Stack part.