Note: This topic is updated to replace the sample code found in the api.chm.
A Web Service Event Sink must be implemented in order to receive the notifications when the Programmatic Alerts are triggered.
The Web Service Sink is a web service that implements WsEventSink.wsdl.
It should publish the following methods:
- actionItemModified
- categoryConditionMet
- deliverableModified
- phaseModified
- multipleCategoryConditionMet
- itemAddedToPortfolio
Each one of the psPortfoliosWebServiceAlert methods accepts a parameter (webServiceURL) that holds the URL where the Web Service Event Sink is hosted.
The system will process events one by one, and call the registered Event Sink URLs with the relevant method which correlates to the event being triggered.
The easiest way to implement the Web Service Sink is to start with the WSEventSinkSample (for Microsoft Visual Studio 2015).
For Example: AddItemAddedAlert was called to add a Programmatic Alert on portfolio “Customers” and with webServiceURL set to "http://MyServer/ProSightEventSink/EventSink.asmx".
Once the alert is added, whenever an item is added to the “Customers” portfolio, the System's Alerts Engine will call the Web Service method itemAddedToPortfolio at the above mentioned URL, sending it all the event details.
Implementation Best Practices:
- When implementing the Web Service Event Sink, It is recommended that the methods that implement the WsEventSink.wsdl return in a very short length of time (less than a second). This is to make sure that the hosting application is always responsive and that the PPM Alerts Engine processing is not delayed. If there is a need for longer processing, it is advised to use some sort of static queue to hold all alerts dispatched and to process them using a separate thread.
- Remember to delete Programmatic Alerts which are not in use, or use the ExpirationTime property to set the Alert to expire after a certain amount of time.
- In some special cases, Alert notifications can be sent more than once. Protect the Event Sink code by “remembering” alerts that were previously received, using the AlertGuid and EventDateTime properties.