简体   繁体   中英

When is onServiceFault called in milo opc ua client?

I hava a milo opc ua client and added a fault listener with client.addFaultListener(this) and I have overridden the method onServiceFault (so that it implements ServiceFaultListener).

When I shutdown my opc ua server I only get a messages from milo: [WARNING][org.eclipse.milo.opcua.sdk.cli] [4] Keep Alive failureCount=1 exceeds failuresAllowed=0 but my fault listener is not executed.

In what cases is the onServiceFault listener executed by milo?

It's called when the client actually receives a ServiceFault response from the server, which can happen in a variety of scenarios, one of which being that the server doesn't support a service that you've called.

Shutting down the server like you did should result in onSessionInactive being invoked on any SessionListener you've added to the client.

I think I can now answer my question by myself: for example it is called when the servers connection is lost and milo does a reconnect but the transfer of subscriptions fails and when this invalid subscription is used afterwards, then milo will execute a ServiceFault like this with status Bad_SubscriptionIdInvalid.

ServiceFault(responseHeader=ResponseHeader(timestamp=DateTime{utcTime=132556030188286769, javaDate=Wed Jan 20 08:56:58 CET 2021}, requestHandle=116, serviceResult=StatusCode{name=Bad_SubscriptionIdInvalid, value=0x80280000, quality=bad}, serviceDiagnostics=null, stringTable=[], additionalHeader=ExtensionObject{encoded=ByteString{bytes=null}, encodingId=NodeId{ns=0, id=0}})) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM