Error Writing OPC-UA Node

I am trying to write a tag that references a ManagedDevice implementation using the Milo OPC-UA driver.

The following is the error that the designer throws at me:

Error writing to InterMessageDelay.value: Bad("Bad_InternalError: An internal error occurred as a result of a programming or configuration error.")

The following is the snipped of my code that implements the write AttributeFilter:

UaVariableNode interMessageDelaysNode = UaVariableNode.builder(getNodeContext())
                .setDisplayName(new LocalizedText("InterMessageDelay"))
        interMessageDelaysNode.setValue(new DataValue((new Variant(0))));
                getAttributeContext ->
                        new DataValue(new Variant(snmpDevice.getInterMessageDelay()))
        interMessageDelaysNode.getFilterChain().addLast(AttributeFilters.setValue((ctx, value) -> {
            snmpDevice.setInterMessageDelay((Integer) value.getValue().getValue());
            ctx.setAttribute(AttributeId.Value, value);


This line is probably causing a ClassCastException to be thrown and not caught by your code. You set the DataType to UInt32, so you should expect a org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger value.

Thank you for the quick response!

Here is the method signature inside my SNMPDevice class:

public void setInterMessageDelay(int interMessageDelay){ this.interMessageDelay = interMessageDelay; }

What is the correct way to pass only the value that is contained in DataType to this method?

Easiest thing to do would be just change the DataType of your “InterMessageDelay” VariableNode to BuiltinDataType.Int32.

That would work except I’m using that variable to call sleep which takes a long as it’s input. So ultimately I will need this value to be a basic Java type.

Thanks again Kevin.

I found that UInteger has a intValue method and I changed my setValue filter to the following:

interMessageDelaysNode.getFilterChain().addLast(AttributeFilters.setValue((ctx, value) -> {
            UInteger uInteger = (UInteger) value.getValue().getValue();

            ctx.setAttribute(AttributeId.Value, value);