Method SetSubscriptionDurable

General topics regarding OPC Foundation and communication technology in general.

Moderator: Support Team

Post Reply
ZigoZago
Full Member
Full Member
Posts: 5
Joined: 12 Feb 2025, 13:47

Method SetSubscriptionDurable

Post by ZigoZago »

Hello,

I want to use the setSubscriptionDurable method but I can't find the SubscriptionId.

I always get "Failed with error BadSubscriptionIdInvalid".

Thanks for help.
Regards.

Image

ZigoZago
Full Member
Full Member
Posts: 5
Joined: 12 Feb 2025, 13:47

Re: Method SetSubscriptionDurable

Post by ZigoZago »

Imagefile:///E:/Untitled.png

ZigoZago
Full Member
Full Member
Posts: 5
Joined: 12 Feb 2025, 13:47

Re: Method SetSubscriptionDurable

Post by ZigoZago »

Image

User avatar
Support Team
Hero Member
Hero Member
Posts: 3252
Joined: 18 Mar 2011, 15:09

Re: Method SetSubscriptionDurable

Post by Support Team »

Hi,

the SubscriptionID can be found in the "Server Diagnostics View".
Menu->Document->Add...

The diagnostics view will create its own subscription, therefore there can be multiple subscriptions running in one session. Hence make sure you are using the correct one (the ID that is attached to the DA View) that you want to set durable.
Best regards
Unified Automation Support Team

ZigoZago
Full Member
Full Member
Posts: 5
Joined: 12 Feb 2025, 13:47

Re: Method SetSubscriptionDurable

Post by ZigoZago »

Hi,

thanks i found SubscriptionId with your suggest.

Now i receive BadInvalidState.

What could be the problem?

Regards.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3252
Joined: 18 Mar 2011, 15:09

Re: Method SetSubscriptionDurable

Post by Support Team »

Hi,

if still not working, your server may not support this feature.
You should check with the server manufacturer.
Best regards
Unified Automation Support Team

ZigoZago
Full Member
Full Member
Posts: 5
Joined: 12 Feb 2025, 13:47

Re: Method SetSubscriptionDurable

Post by ZigoZago »

Maybe this is the problem :

Bad_InvalidState

Defined in OPC 10000-4

This is returned when a Subscription already contains MonitoredItems.

I think yes to subscribe but not monitor to be able to use the method.

Could it be?

Thanks.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3252
Joined: 18 Mar 2011, 15:09

Re: Method SetSubscriptionDurable

Post by Support Team »

Hi,

yes, the SetDurable can only be called as long as the subscription is "empty". After being set durable, you can add the monitored items to the subscription. the server will persist the queue (instead of holding in memory only), hence will survive long interruption AND shutdown of the server itself.

The client must (after reconnect) get hold on his old subscription (TransferSubscription) in order to receive the persisted item queue. The DAView of UaExpert can display "last" value, hence will not be suitable for testing. You can use C++ SDK and implement the client and the server functionality accordingly.

Note: depending on your use case the "Historical Access" (HA) might be a better approach.
Best regards
Unified Automation Support Team

Post Reply