What is the best place to do a automatically for the client to do a re-subscribe when OPC UA server restarts

433 views Asked by At

I have figured out that when my OPC UA server restarts then my Milo OPC UA Client (sdk-client 0.5.3) is automatically doing a reconnect to the server, that's nice! But subscriptions do not do a re-subscribe.

So, is there an option for the subscription or the SubscriptionManager to do this re-connect internally and automatically?

Or do I have to do this by my own? I have read about addSubscriptionListener and do this onSubscriptionTransferFaild - but this is the wrong place, because this is when the connection gets lost - the re-subscribe will fail - the reconnect should be done when the OPC UA connection comes up again. Where would be the best place to do this reconnects? Is there some listener which fires when the client reconnects to the server?

1

There are 1 answers

1
Kevin Herron On BEST ANSWER

I have read about addSubscriptionListener and do this onSubscriptionTransferFaild - but this is the wrong place, because this is when the connection gets lost - the re-subscribe will fail

This actually is the right place.

When the connection is finally re-established the client will attempt to resume your old Session, which will fail, and then to transfer your previous Subscriptions to your new Session, which will fail. When these Subscription transfers fail the onSubscriptionTransferFailed callback will be invoked for each Subscription.