Steve Boyko

Events Stop Coming?

Discussion created by Steve Boyko Champion on Sep 19, 2014
Latest reply on Sep 23, 2014 by Marcos Vainer Loeff

I wrote an application a while ago that subscribes to events from a number of tags, and then does some processing whenever the events arrived. A few days ago it appears it just stopped processing events. The program (service) was still running, PI Network Manager showed it still connected and active, PI Update Manager showed it still subscribed to its tags with no events waiting, yet it appears my program was not processing the events.

 

Here's the code I used to subscribe:

 

 

 
            datapipe = pipoint.Data.EventPipe;
            eventpipe = (_DEventPipeEvents_Event)pipoint.Data.EventPipe;
            eventpipe.OnNewValue += new _DEventPipeEvents_OnNewValueEventHandler(PIEventsToSQL.PIDataEventHandler);
            issubscribedtoevents = true;

 And here's the body of PIDataEventHandler, the main routine that gets fired when events come in.

 

 

 
        public static void PIDataEventHandler()
        {
            try
            {
                for (int i = 0; i < lstPoints.Count; i++)
                {
                    if (lstPoints
.EventCount() > 0)
                    {
                        Array events = lstPoints
.GetEvents();
                        SortedDictionary<DateTime, PIValue> SortedEvents = new SortedDictionary<DateTime, PIValue>();
                        for (int j = 0; j <= events.GetUpperBound(0); j++)
                        {
                            iCtrPIEventsReceived++;
                            PIEventObject peo = (PIEventObject)events.GetValue(j);
                            PointValue pv = (PointValue)peo.EventData;
                            SortedEvents.Add(pv.PIValue.TimeStamp.LocalDate, pv.PIValue);
                        }

                        foreach (KeyValuePair<DateTime, PIValue> p in SortedEvents)
                        {
                            TryEnqueuingPIValue(p.Value, i);
                        }
                    }
                }
                return;
            }
            catch (Exception e)
            {
                ReportMessage("Error " + e.Message + " handling PI data event(s): " + sDoing, ReportingLevels.Warning);
            }
        }

I know the counter iCtrPIEventsReceived was not being incremented as it is periodically reported to the event log.

 

Any ideas on what might have gone wrong? I appreciate the help!

Outcomes