jrapin

Delivery End Point never called when Notification created by SDK

Discussion created by jrapin on Jul 2, 2012
Latest reply on Jul 10, 2012 by jrapin

Hello,

 

I am using a Delivery End Point calling a Web Service, which I subscribe to several Notifications. It is supposed to be called each time a Notification becomes Active or gets back to Inactive. The issue I face is the following: the Delivery End Point is not called when a Notification created using the SDK is triggered.

 


When I create the Notification using PI System Explorer interface, it triggers the Delivery End Point properly when it is triggered, which calls the Web Service.

 


However, if I create the Notification using the PI Notification SDK in C#, the Notification becomes active and inactive according to its conditions, but the Web Service is never called.

 

0451.1.png

 

A Delivery End Point is preconfigured as shown is the above screenshot, with a parameter left empty.

 

The following code is the one which is use to configure a Notification and subscribe the Delivery End Point to it:

 
// The variable 'alert' is a business object encapsulating the AF Notification// The variable 'afContactName' is the name of the existing Delivery End Point (here 'FM_Aggregated_Alerts_Calculation')// Retrieves an existing notification or create one with the given name
AFNotification notification = AFUtil.Instance.GetAFNotification(alert.Name);
 
// If the Delivery End Point existsif (!notification.NotificationContacts.Contains(afContactName))
{
// Retrieves the Delivery End Point preconfigured
AFNotificationContactTemplate contactTemplate = null;
List<AFNotificationContactTemplate> tpls = notification.Database.PISystem.NotificationContactTemplates.ToList();
foreach (AFNotificationContactTemplate tpl in tpls)
{
if (tpl.Name.Equals(afContactName))
contactTemplate = tpl;
}
 
// Adds the preconfigured Delivery End Point to the Notification
notification.NotificationContacts.Add(contactTemplate);
AFNotificationContact contact = notification.NotificationContacts[afContactName];
 
// Computes the string to use as a parameter for the Delivery End Point
String[] split = alert.AFAttributeFullPath.Split('|');
String targetElementPath = split[0];
 
// Modify the Delivery End Point config string to include the parameter
String cfg = "<Parameters><elementPath ParameterType=\"System.String\" DisplayName=\"\" ContentType=\"\">{0}</elementPath></Parameters>";
String oldConfigString = String.Format(cfg, String.Empty);
String newConfigString = String.Format(cfg, targetElementPath);
contact.ConfigString = contact.ConfigString.Replace(oldConfigString, newConfigString);
 
// Check In the notification
notification.CheckIn();
}

The result of this code is the creation of a notification which appears to be properly configured, with a parameter as shown in following screenshot:

 

5165.2.png

 

However, the Notification doesn't call the Delivery End Point when it is triggered. The following screenshot shows the

 

5076.3.png

 

Do I miss something in my code that would link the Notification and the Delivery End Point ? Any idea of how to fiw this problem ?

 


Thank you in advance for your answers.

 

Regards

Outcomes