Hello dev geeks, I need your help...
Context: PI/AF Server 2010, AF Client & SDK 2012 SP2 (126.96.36.19996), PI Notification 2012 (1.2.1205.10)
I built a custom delivery channel that push notification data to IBM Maximo for asset meter reading automatic fill, everything works flawlessly and quite fast. The Send override code contains a lot of error management (simple warnings, failure conditions and pure try/catch) which are stored by the AFTrace and also recorded in the Notification target Element Attributes. Everything is fine until now...
I need to report critical errors to an AD support group and I thought about tweaking the notification instance acknowledgement system with the Escalation system to do so. Here is how I did it: Notification template has 2 subscriptions (Custom DC & Escalation team) and require 1 acknowledgement. Escalation period is configured to 2 x Retries x Retry Interval and will repeat 3 times.
1. Notification instance calls Custom DC contact, Send function > code found error, throw an exception which is logged everywhere, instance not acknowledge and get escalated, escalation group receive email and ack the notification instance.
2. Notification instance calls Custom DC contact, Send function > code runs without finding any error, and programatically self-acknowledge the notification instance.
My questions are:
- Why is it taking over 60 seconds to self-ack?
- Is there a better/other method to achieve my goal of communicating issues to a support group that would not involve coding outside the Custom DC plug-in?
Here is what I have tried (FYI, I also made some blind changes to the parameters of those functions, just in case...):
Using the AcknowledgeInstance
OSIsoft.AN.Service.ANAnalysisNotificationInfo _ANAnalysisNotificationInfo= new OSIsoft.AN.Service.ANAnalysisNotificationInfo(); _ANAnalysisNotificationInfo.UniqueID= results.NotificationUniqueID; _ANAnalysisNotificationInfo.SystemID= results.SystemID; _ANAnalysisNotificationInfo.DatabaseID= results.DatabaseID; ANNotification.AcknowledgeInstance(ANNotification.GetNotification(_ANAnalysisNotificationInfo),results.NotificationInstanceID,results.ContactID,"Automatic Acknowledge");
Using the AcknowledgeSubscription
ANNotification.AcknowledgeSubscription(this.Notification, results.NotificationInstanceID, this.NotificationTemplate.NotificationContacts["DCCONTACTNAME"].ID, "Automatic Acknowledge");
Using a Threaded AcknowledgeSubscription after reading in PIDevClub this might be a solution...
Thread t_ack = new Thread(() => ANNotification.AcknowledgeSubscription(this.Notification, results.NotificationInstanceID, this.NotificationTemplate.NotificationContacts["DCCONTACTNAME"].ID, "Automatic Acknowledge")); t_ack.Start(); Thread.Sleep(1000); t_ack.Join();
Still, it takes over 60 seconds to ack while the rest of the Send function takes less than 2 seconds to proceed... I intend to receive 5k+ events per day on a single Notification processor so it's going to pile up and make huge latency...
All ideas are welcome,