Home > Software design >  How to catch the change of monitoredItems in Milo OPC UA?
How to catch the change of monitoredItems in Milo OPC UA?

Time:09-01

I am writing a client using the Milo library in the Java programming language. 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. 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?

CodePudding user response:

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.

  • Related