OnNewValue Event (EventPipe object)



This event is fired when the EventPipe receives a new item for the EventPipe's Parent from the server. User programs define a handler for the event to be notified of the arrival of new events in the pipe.  Using this strategy a program can avoid having to continually poll the EventPipe to determine if there are new EventObjects to be processed.   



Private Sub object_OnNewValue

The object placeholder is an object expression that evaluates to an EventPipe object.


The firing of this event is subject to the settings in the NotifyThreshold and MaxNotifyFrequency properties of the EventPipe.  These properties act as filters on the event firing.  By default the NotifyThreshold is set to a count of 1 and the MaxNotifyFrequency is set to 1000 milliseconds.  The NotifyThreshold represents the minimum number of items in the pipe necessary for the OnNewValue event to be fired.  MaxNotifyFrequency  is the minimum amount of time that must have elapsed since the last event firing for the OnNewValue event to be fired.  When a new item arrives in the EventPipe, it checks to see if the NotifyThreshold has been reached and if the MaxNotifyFrequency has been exceeded before firing the event.  These properties are useful for applications that use EventPipes that receive many items but want to process them only occasionally.


Two interesting cases should be noted.  The first event to arrive in an EventPipe after it is instantiated will not be governed by the MaxNotifyFrequency property as there was no earlier firing from which to determine the frequency interval.  Successive events will respect the property.


When a new event comes in that meets the NotifyThreshold criteria but not enough time has elapsed to meet the MaxNotifyFrequency criteria, no event is fired.  As time passes and no new items arrive in the EventPipe, the interval specified in the MaxNotifyFrequency property will be exceeded but no events are fired.  So both filters are now satisfied but the precondition of a new item arriving does not occur.  At this point the count in the EventPipe is not changing as no new items are arriving.  The MaxNotifyFrequency property does not act as a timer.  To achieve this effect, an application could declare a Windows Timer and when it triggers, check the EventPipe count.



Enabling Operational Intelligence