SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Posted: 2018-07-05 02:56 AM
Link copied. Please paste this link to share this article on your social media post.
The issue with notifications for subscriptions is still happening with my smart connector. Even with code added, to try and clear them manually, they are building up to a point that means deleting the EWS endpoint cannot happen without manually dropping the contents of the table through SQL management tools.
if (IsConnected)
{
foreach (var subscription in DataAdapter.Subscriptions)
{
DataAdapter.DeleteNotifications(subscription);
}
var subscriptionList = DataAdapter.Subscriptions.ToList();
if(subscriptionList.Count > 0)
DataAdapter.DeleteSubscription(subscriptionList.Where(a => a.Status != EwsSubscriptionStatusEnum.Active).ToList());
}
}
catch (Exception exception)
{
Logger.LogError(LogCategory.Processor, "Error'd when trying to clean up subscriptions " + exception.Message);
}
Link copied. Please paste this link to share this article on your social media post.
Hi James,
As far as I know this should be working. I will investigate and let you know!
Regards,
-Jeff
Posted: 2018-07-05 07:43 AM
Link copied. Please paste this link to share this article on your social media post.
Well the client is currently on .117 but if it's fixed in .118 we can upgrade to that version. I looked at the release notes and didn't see the change mentioned. This is the one you have looked at before for Theo.
Link copied. Please paste this link to share this article on your social media post.
Hi James,
I do remember something about needing to add code like this, but I can't remember a time where the underlying DeleteNotifications code was changed in the recent past.
I took a look at the source code, and something does look a little weird (maybe). I'll look into it and if it turns out to be the problem, I will likely release a .119 with this fix.
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi James,
When you run this code, is your processor ending successfully or do you see errors in your log?
Is there any way you could turn on 'Database' logging from the logging filters page and turn the level on trace and then send me your log after this code has tried to execute a few times?
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi James,
Can you try the below code? We have tested out this code in an extension in the lab and it seems to work. I have bolded was has changed/added from what you had before.
if (IsConnected)
{
var subscriptionList = DataAdapter.Subscriptions.ToList(); // This was moved up
foreach (var subscription in subscriptionList)
{
DataAdapter.DeleteNotifications(subscription);
}
if(subscriptionList.Count > 0)
DataAdapter.DeleteSubscription(subscriptionList.Where(a => a.Status != EwsSubscriptionStatusEnum.Active).ToList());
}
}
catch (Exception exception)
{
Logger.LogError(LogCategory.Processor, "Error'd when trying to clean up subscriptions " + exception.Message);
}
I think this should work. However, I do wanna add that I noticed in my testing that when DeleteNotifications is executed, even though it is taking in a subscription ID, it is actually deleting ALL Notifications for all subscriptions except the current one for the first subscription that was sent it.. This is definitely a bug. Let me know if you want a new version of Smart Connector with this fix, or if its ok for now (it will be OK if you only have 1 instance of EBO communicating to your EWS server since only a single subscription is maintained by EBO).
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi Jeff,
I found this happening on another server which was most unexpected, I haven't validated but it appears that this could be happening on any instance where a custom EWS server has been implemented. - We don't see this happening where we just have processors but have seen it where a custom server exists. Thought that might be worth looking into. It's certainly a bug somewhere and we could do with this being patched in the next release as a priority.
Thanks,
Adam.
Link copied. Please paste this link to share this article on your social media post.
James Petcher did you manage to try the code sample above? I am curious as to if it solved your problem.
Regards,
-Jeff
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.