Share via


Transient Provider

Because the state associated with event correlation frequently must be persistent and it is inefficient to use the repository to state storage, the transient provider is provided. This provider is implemented as an in-process COM object and autonomous entity.

Note  For more information about support and installation of this component on a specific operating system, see Operating System Availability of WMI Components.

The following sections are discussed in this topic:

  • Transient Provider
  • Aggregate Properties
  • Aggregate Qualifiers
  • Instance Timers

Transient Provider

The transient provider provides __InstanceOperationEvent classes for operations on transient state. Thus the transient state class must be derived from MSFT_TransientStateBase. If the transient class does not derive from this class, the transient provider cannot provide events for operations on its instances, leaving ESS to poll for changes.

The transient provider allows you to declare your correlation state classes as transient using the dynamic and provider qualifiers.

The following example shows how to use the dynamic and provider qualifiers.

[dynamic, provider ("Microsoft WMI Transient Provider")]
class MyState
{
  sint32 Prop1;
};

As well as storing transient state, the transient provider supports additional qualifiers necessary to perform time-based averaging and instance-related issues.

When an instance is created through the transient provider, the identity of the creator is stored with the instance. Only this identity is able to modify the instance.

Windows Server 2003: When you install WMI, the transient providers are not loaded by default. To install the transient providers, in Control Panel, click Add or Remove Programs, and then click Add/Remove Windows Components.

Aggregate Properties

Though UQL supports some limited arithmetic expressions, at times it is preferable to express aggregation primitives declaratively instead of using complex mathematical formulae. To this end, the transient provider supports aggregate properties whose values are automatically computed by the transient provider as an aggregation of other values over time.

The following example shows the class property qualifiers that enables the designation of a property as an aggregate property and specifies its behavior.

[trns_time_average, trns_value_is(PropName),
    trns_switch_is(BooleanPropName)]

Aggregate Qualifiers

The following aggregate qualifiers are used to specify the behavior of a property.

  • trns_time_average
    Specifies that this property contains the time-weighted average value of the property specified by the trns_value_is qualifier. Time-weighting means that the longer a value is in effect, the more weight it carries in the averaging process. Time-based averaging does not work with unit64 data types.

  • trns_value_is
    Specifies that this property value is used to compute the value of the aggregate property.

  • trns_switch_is
    Optional Boolean which, if specified, determines whether the value of the trns_value_is property is currently being used in the averaging process. Thus, the averaging process can be turned on and off by another property. When the averaging process is off, the value of the average does not change and the entire time period during which the averaging process is turned off is ignored in the averaging calculations.

Instance Timers

The transient provider supports the concept of timers associated with particular instances. These timers exist as numeric properties of a transient class where the property's value is the number of seconds before the expiration of the timer. The timer's value can be set, permitting you to affect the expiration of the timer in the following ways:

  • The timer is started when it is set to a nonzero value from a previous value of either zero or null.
  • The timer is reset when it is set to a new value greater than zero.
  • The timer is removed when it is set to zero.

Because the Instance Timer is exposed as a regular instance property, its value can be read at any time to see how much time is left before expiration. Further, because the timer is manipulated through assignments to a property, it can be easily managed using the updating consumer.

A timer is declared by placing the trns_egg_timer qualifier on a numeric property. The time unit of the timer is seconds; however, if the data type of the property is a floating-point numeric type, the time intervals may be expressed with milliseconds precision, though the unit of time is still seconds. That is, the floating-point value 5.0 specifies 5 seconds, not 5 milliseconds. Five milliseconds would be represented with the floating-point value 0.005.

The following example shows the event that is fired when the timer expires.

class MSFT_TransientEggTimerEvent : __ExtrinsicEvent
{
  string ClassName;
  object Object;
  string PropertyName;
};

For more information, see Standard Qualifiers.