Professional OPC
Development Tools

logos

subscription handle value on bad connection

More
23 Jun 2020 05:53 #8621 by support
Hello.

There are no "bad" subscription handles, because subscriptions are long-term concept, and their state and the moment you call Subscribe is irrelevant. A subscription that is OK at that time can go into error later, and vice versa: a subscription that cannot be made at that time can become possible later. Error recovery is built into QuickOPC.

The state of all subscriptions is reported through the notification channel (events or callbacks) only.

- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...e.html#Failure%20Recovery.html

- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...rors%20in%20Subscriptions.html

- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...0OPC%20failure%20recovery.html

Best regards

Please Log in or Create an account to join the conversation.

More
23 Jun 2020 03:25 #8620 by cadomanis
It appears that if attempting to subscribe with the following code, and a connection is not made a subscription handle of value 12586002 is returned?
        public bool Subscribe()
        {
            try
            {
                this._client.DataChangeNotification += this.ParseData;
                this._subscriptionHandles = this._client.SubscribeMultipleMonitoredItems(new[]
                    {
                    new EasyUAMonitoredItemArguments(null, this._serverEndpoint, this._statusEndpoint, this.OpcUaUpdateRate)
                });
                this.ConnectedState = true;
                return true;
            }
            catch (Exception ex)
            {
                StaticLogger.Log(this.GetType(), LoggingLevel.Error, "Error", nameof(Subscribe), ex, true);
                return false;
            }
        }

Is that the expected value on a bad connection, such that that handle should be ignored? Or if after attempting the SubscribeMultipleMonitoredItems I immediately see the event handler return with a succeeded = false, should I be then throwing away the subscription handle that was received? Any pointers or extended examples on how to handle failed subscription attempts would be greatly appreciated.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.169 seconds

      

 Recommend this on Google