[英]How to catch the change of monitoredItems in Milo OPC UA?
I am writing a client using the Milo library in the Java programming language.我正在使用 Java 编程语言中的 Milo 库编写客户端。 I have seen examples where the setValueConsumer(Value Consumer value Consumer) or setEventConsumer(EventConsumer eventConsumer) method of the UaMonitoredItem object is used, but as I understood it is necessary only for debugging information/logs.
我已经看到使用 UaMonitoredItem object 的setValueConsumer(Value Consumer value Consumer)或setEventConsumer(EventConsumer eventConsumer)方法的示例,但据我所知,它仅用于调试信息/日志。 Like in this example:
就像在这个例子中一样:
monitoredItem.setEventConsumer((item, vs) -> {
logger.info(
"Event Received from {}",
item.getReadValueId().getNodeId());
});
The question is how to catch the UaMonitoredItem change when using a subscription in order to use this notification in other parts of the application?问题是如何在使用订阅时捕获UaMonitoredItem更改,以便在应用程序的其他部分使用此通知?
There's no reason you can't use this callback in your application as well.您也没有理由不能在您的应用程序中使用此回调。 The example just doesn't other parts of an application to do anything with it.
该示例只是没有应用程序的其他部分对其进行任何处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.