@@ -107,10 +107,6 @@ public CompletableFuture<OpcuaSubscriptionHandle> onSubscribeCreateMonitoredItem
107
107
new QualifiedName (0 , OpcuaProtocolLogic .NULL_STRING ));
108
108
109
109
MonitoringMode monitoringMode = MonitoringMode .monitoringModeReporting ;
110
- if (PlcSubscriptionType .CYCLIC == tagDefaultPlcSubscription .getPlcSubscriptionType ()) {
111
- monitoringMode = MonitoringMode .monitoringModeSampling ;
112
- }
113
-
114
110
ExtensionObject eventFilter = OpcuaProtocolLogic .NULL_EXTENSION_OBJECT ;
115
111
if (tagDefaultPlcSubscription .getPlcSubscriptionType () == PlcSubscriptionType .EVENT ) {
116
112
NodeId nodeId = new NodeId (new NodeIdFourByte ((short ) 0 , OpcuaNodeIdServicesObjectType .BaseEventType .getValue ()));
@@ -219,22 +215,25 @@ private void sendPublishRequest() {
219
215
outstandingAcknowledgements .add (new SubscriptionAcknowledgement (this .subscriptionId , availableSequenceNumber ));
220
216
}
221
217
222
- for (ExtensionObject notificationMessage : responseMessage .getNotificationMessage ().getNotificationData ()) {
223
- ExtensionObjectDefinition notification = notificationMessage .getBody ();
224
- if (notification instanceof DataChangeNotification ) {
225
- logger .trace ("Found a Data Change Notification" );
226
- DataChangeNotification data = (DataChangeNotification ) notification ;
227
- if (!data .getMonitoredItems ().isEmpty ()) {
228
- onMonitoredValue (data .getMonitoredItems ());
229
- }
230
- } else if (notification instanceof EventNotificationList ) {
231
- logger .trace ("Found a Event Notification" );
232
- EventNotificationList data = (EventNotificationList ) notification ;
233
- if (!data .getEvents ().isEmpty ()) {
234
- onEventNotification (data .getEvents ());
218
+ NotificationMessage message = responseMessage .getNotificationMessage ();
219
+ if (message .getNotificationData () != null ) {
220
+ for (ExtensionObject notificationMessage : message .getNotificationData ()) {
221
+ ExtensionObjectDefinition notification = notificationMessage .getBody ();
222
+ if (notification instanceof DataChangeNotification ) {
223
+ logger .trace ("Found a Data Change Notification" );
224
+ DataChangeNotification data = (DataChangeNotification ) notification ;
225
+ if (!data .getMonitoredItems ().isEmpty ()) {
226
+ onMonitoredValue (data .getMonitoredItems ());
227
+ }
228
+ } else if (notification instanceof EventNotificationList ) {
229
+ logger .trace ("Found a Event Notification" );
230
+ EventNotificationList data = (EventNotificationList ) notification ;
231
+ if (!data .getEvents ().isEmpty ()) {
232
+ onEventNotification (data .getEvents ());
233
+ }
234
+ } else {
235
+ logger .warn ("Unsupported Notification type {}" , notification .getClass ().getName ());
235
236
}
236
- } else {
237
- logger .warn ("Unsupported Notification type {}" , notification .getClass ().getName ());
238
237
}
239
238
}
240
239
}).whenComplete ((result , error ) -> {
0 commit comments