Home > Back-end >  The Java implementation issues of opcUA subscription
The Java implementation issues of opcUA subscription

Time:01-29

Through the Java implemented opcUA to read and write the tag in the server, but subscribe to the effect is not ideal:

Public static void main (String [] args) {
Test02 Test02=new Test02 ();
Try {
//to connect server
1. Test02. ConnectServer ();
//execute subscription feature
2. Test02. CreateSubscription (test02. Client);
3.//Thread. Sleep (20000);
} the catch (Exception e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}
}


Phenomenon description: (1) the main method, if there is no step 3, the main method completes and directly from top to bottom end, subscription method just perform it again, the callback function does not perform, (2) remove the main method in step 3 comments, run again the main method, a thread sleep during this time, the tag in the server changes, subscribe to the callback function in the function can be normal execution, to sleep time, when the tag in the server changes again, subscribe to the callback function to perform again, this time the main method has ended,

What the reasons for the above situation is, how do you use to subscribe to use, how to subscribe to work?
  • Related