1 Reply Latest reply on Nov 9, 2012 7:41 PM by Mike Zboray

    PI Notification Delivery Channel to Database Table


      How can I take a notification event and write results to an Oracle database? 


      One solution I am considering is to create a custom delivery channel that makes a call to a web service for a notification when it triggers. I will have multiple notifications using the same channel so it will need to be able to identify itself (which notification). I would also like to send the current values of a number of attributes from different elements in this web service call


      I am not sure how to accomplish this so any example or advise is greatly appreciated.




      Here is some info on what I need to achieve and why


      Requirement Detail


      I have a requirement to monitor particular PI tags and determining when the value falls outside of a range. I need to create a record in an Oracle database with the beginning and end time that the value fell out of range and then fell back in again plus I will gather other PI data as well for the event. I already plan to use AF to set up elements with the min/max values and use an enumerated formula to determine the state (normal, out of range high, out of range low,...)


      I was first considering writing a standalone process to monitor each element but would really like to leverage PI Notifications. 


      Basically, my question is:


      What is the best way to write the results of a number of tags to an oracle table record on a PI notification trigger? I am thinking that somehow I would have a delivery channel write to a web service. Does anyone else have any suggestions of solving this? Maybe even something outside of notifications if there is a more feasible way? I was ruling out event frames for this because we are using some standard report making tools ad also will be forming relationships with this table against existing tables.


      Also, if a web call is the best solution, I would greatly appreciate an example or any examples for other ideas.


      I greatly appreciate any and all help in this


      Thank You

        • Re: PI Notification Delivery Channel to Database Table
          Mike Zboray

          Hey Mike,


          A custom delivery channel is one way to achieve this. Does the Oracle DB already have a web service component? Is there a redistributable library for communicating with the database?


          If there is a web service component already existing, the Web Service delivery channel distributed with Notifications may work for you. However, it is limited to sending primitive data types and certain special pieces of content are not available to it (e.g. Triggering Condition). If that doesn't work you, then a custom delivery channel would be the way to go.


          With a custom delivery channel there are two kinds of architectures you can go with. One is that you have your custom delivery channel directly which calls to the database through whatever library Oracle supports. Another is that your delivery channel makes a call to a service hosted elsewhere that then makes calls through said library to the Oracle DB. The difference between these is that the first is easier to code, but it requires whatever libraries either already deployed on client machines or redistributable via AF's support assembly feature. The second can require a little more work up front (you need to write a delivery channel and a service that it can talk to), but is easier to maintain over time because you don't need libraries distributed to many machines. The second architecture is used by the OCS Delivery Channel. It actually does not talk to OCS directly but instead communicates with a intermediary we call the OCS Relay Service. We chose this architecture because sending to OCS requires libraries that are not redistributable via AF's support assembly feature and special provisioning of the service machine on the OCS server.


          There are sample delivery channels provided in the Notifications Developer Tools that you can look at. Check the download center under PI Analytics. Also if you are going to vCampus in a few weeks there is a session on writing a custom delivery channel that a couple of us Notifications developers will be attending.