I'm writing some software to interface with the SmartConnector RESTFul EWS Gateway API. I'm making good progress but I need some guidance on how to best handle Subscriptions.
My understanding of subscriptions is that to Subscribe, I can POST a request that includes the set of value IDs I'm interested in, set up the Notifications and then poll for changes. When I’m done I can send a DELETE and it’s cleaned up.
This is working fine, but I don't know up front the set of values I'll need, and I expect that set to change significantly over a short period of time (it’s a dynamic set, I can’t know what’s needed). So I'm working on a way to optimally subscribe to values when I don't know up front what set of values I'll need, but I can't find a way in the documentation to alter a Subscription once it's been created which has left me stuck.
I've identified a few options to work around this, but none of them really seem right to me. I would very much appreciate some insight!
Option 1. Every time I need a new value I create a subscription just for that value. Seems inefficient, and will create a bunch of overhead trying to manage and poll all those subscription, effectively defeating the purpose.
Option 2. Every time I need a new value I delete my existing subscription and create a new one with the combination of my existing subscription and the new value. Creates a lot of overhead in managing all the creates/deletes and will prevent updates while this occurs.
Option 3. I discover and permanently subscribe to all values available from the API so I never have to deal with this issue. Creates a lot of unnecessary messaging and processing overheads.
Option 4. A hybrid approach where I use Option 1 until I hit a threshold then use Option 2 to keep the number of subscriptions to a manageable level without incurring too much create/delete overhead. Still have issues with unsubscribing values, but it limits impacts. This is what I will do unless I can find a better way.
I'd really like an option 5 that is better than these! The best thing would be a way of altering an existing Subscription to get around the problem.
Is there a best practise way of doing this?
This Community being focused on Industrial Automation, won't be able to provide you any insight about Building Automation topics.
I would recommend you connect with your local sales or Customer Care Center, to get the answer to this issue.
Power & Building Community Manager
Discuss challenges in energy and automation with 30,000+ experts and peers.
Find answers in 10,000+ support articles to help solve your product and business challenges.
Find peer based solutions to your questions. Provide answers for fellow community members!