-1

I'm currently working with the OPC UA Foundation Java Stack, without any additional SDK's.

I am unable to implement subscriptions with monitored items and to get the change notifications via the publish response. I am new to Java, any help regarding this would be really helpful. Thank you.

karthik v
  • 1
  • 1

1 Answers1

-1

This is C#, not Java but you should be able to translate it. I hope it helps.

if (this.subscription == null)
{
    this.subscription = new Opc.Ua.Client.Subscription(this.session.DefaultSubscription)
    {
        PublishingInterval = this.config.ReportingInterval,
        TimestampsToReturn = TimestampsToReturn.Both
    };

    this.session.AddSubscription(subscription);
    subscription.Create();
}

item = new MonitoredItem(subscription.DefaultItem)
{
    StartNodeId = new NodeId(property.Identifier, this.config.NamespaceId),
    SamplingInterval = this.config.SamplingInterval,
    QueueSize = this.config.QueueSize,
};

subscription.AddItem(item);
subscription.ApplyChanges()
astrowalker
  • 3,123
  • 3
  • 21
  • 40